Loading files
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Leap.Unity.Apps.Launcher {
[AddComponentMenu("")]
public class FollowTransform : MonoBehaviour {
public Transform target;
public enum FollowMode { Update, FixedUpdate }
public FollowMode mode;
private void Update() {
if (mode != FollowMode.Update) return;
if (target != null && target.gameObject.activeInHierarchy) {
this.transform.position = target.transform.position;
this.transform.rotation = target.transform.rotation;
}
}
private void FixedUpdate() {
if (mode != FollowMode.FixedUpdate) return;
if (target != null && target.gameObject.activeInHierarchy) {
this.transform.position = target.transform.position;
this.transform.rotation = target.transform.rotation;
}
}
}
}
36cc7c005This file is pinned to the selected release. Download the original to open it in your design tool.