/// <summary> /// Refresh delegate manager. /// </summary> public void Refresh() { var model = this.FindCubismModel(); // Fail silently... if (model == null) { return; } // Set the null value when refreshed UpdateController to avoid duplicated registering. _onLateUpdate = null; // Set delegate. var components = model.GetComponents <ICubismUpdatable>(); var sortedComponents = new List <ICubismUpdatable>(components); CubismUpdateExecutionOrder.SortByExecutionOrder(sortedComponents); foreach (var component in sortedComponents) { #if UNITY_EDITOR if (!Application.isPlaying && !component.NeedsUpdateOnEditing) { continue; } #endif _onLateUpdate += component.OnLateUpdate; } }
/// <summary> /// Refresh delegate manager. /// </summary> public void Refresh() { var model = this.FindCubismModel(); // Fail silently... if (model == null) { return; } // Clear delegate. Delegate.RemoveAll(OnLateUpdate, null); // Set delegate. var components = model.GetComponents <ICubismUpdatable>(); var sortedComponents = new List <ICubismUpdatable>(components); CubismUpdateExecutionOrder.SortByExecutionOrder(sortedComponents); foreach (var component in sortedComponents) { #if UNITY_EDITOR if (!Application.isPlaying && !component.NeedsUpdateOnEditing) { continue; } #endif OnLateUpdate += component.OnLateUpdate; } #if UNITY_EDITOR if (Application.isPlaying) { #endif _parameterStore = model.GetComponent <CubismParameterStore>(); #if UNITY_EDITOR } #endif }