void OnAddInstance() { if (DebugMode) { Debug.Log(GetInstanceID() + ":" + name + ": " + " OnAddInstance"); } // set the data type if not null (Used By Editor Inspector). #if UNITY_WSA && !UNITY_EDITOR DataType = DataInstance.GetType().GetTypeInfo(); #else DataType = DataInstance.GetType(); #endif if (!Application.isPlaying) { return; } // set type casts BindableContext = DataInstance as IObservableModel; if (BindableContext == null) { BindableContext = new ModelBinder(DataInstance); IsWrappedBinder = true; } // subscribe to down messages BindableContext.OnBindingUpdate += RelayBindingUpdate; // Tell the binders of the new data instance var array = Binders.ToArray(); for (int i = 0; i < array.Length; i++) { //was removed if (array[i].Context != this) { continue; } array[i].Model = BindableContext; } }