/// <summary> /// Register the custom late update function. /// </summary> void Start() { mBaseRot = Quaternion.Euler(desiredPitch, 0f, 0f); mTrans = transform; UpdateTransform(1f); SGUpdateManager.AddLateUpdate(0, this, OnLateUpdate); }
/// <summary> /// Ensure that there is an instance of this class somewhere in the scene. /// </summary> static void CreateInstance() { if (mInstance == null) { GameObject go = new GameObject("_SGUpdateManager"); mInstance = go.AddComponent <SGUpdateManager>(); DontDestroyOnLoad(go); } }
void Start() { if (!NetworkManager.isConnected || NetworkManager.IsMine(this)) { mTrans = transform; mRb = rigidbody; SGUpdateManager.AddLateUpdate(-1, this, OnLateUpdate); OnLateUpdate(); } else { Destroy(this); } }
/// <summary> /// Cache some values and register the /// </summary> void Start() { if (cameraToCopy != null) { mCam = camera; mTrans = transform; mTarget = cameraToCopy.transform; SGUpdateManager.AddLateUpdate(1, this, OnLateUpdate); } else if (Application.isPlaying) { Destroy(this); } }
/// <summary> /// Register the late update function. /// </summary> void Awake() { mWidgets = gameObject.GetComponentsInChildren <SGWidget>(); mBars = gameObject.GetComponentsInChildren <SGProgressBar>(); if (mWidgets != null) { foreach (SGWidget w in mWidgets) { w.color.a = mAlpha * alphaTint; w.enabled = w.color.a > 0.01f; } } // Parts of the code rely on updated camera's orientation, so it should be executed after all camera updates. SGUpdateManager.AddLateUpdate(3, this, OnLateUpdate); }
void OnStart() { if (instance != null) { if (!Application.isEditor) { Debug.LogWarning("Can only have one DistantObjects script in the scene!"); Destroy(this); } return; } instance = this; mTrans = transform; mCamTrans = Camera.main.transform; mCameraOrigin = mCamTrans.position; mInitialOffset = mCameraOrigin - mTrans.position; if (Application.isPlaying) { SGUpdateManager.AddLateUpdate(10, this, CustomUpdate); } }
/// <summary> /// Ensure that there is an instance of this class somewhere in the scene. /// </summary> static void CreateInstance() { if (mInstance == null) { GameObject go = new GameObject("_SGUpdateManager"); mInstance = go.AddComponent<SGUpdateManager>(); DontDestroyOnLoad(go); } }
void OnDestroy() { mInstance = null; }
void Start() { mTrans = transform; SGUpdateManager.AddLateUpdate(2, this, OnLateUpdate); }
/// <summary> /// Register the late update callback. /// </summary> void Start() { SGUpdateManager.AddLateUpdate(4, this, OnLateUpdate); }