/// <summary> /// Initializes the synchronized field /// </summary> /// <param name="netView">The NetworkView this value belongs to</param> internal SynchronizedField(PNetU.NetworkView netView) { if (netView == null) { Debug.LogError("Synchronized fields must be initialized with a valid network view!"); return; } if (!typeof(T).IsSerializable) { Debug.LogError("Synchronized field with non serializable Type " + typeof(T)); return; } m_netView = netView; m_value = (T)Activator.CreateInstance(typeof(T)); m_netView.SubscribeToSynchronizedField <T>(this); SendUpdatedValue(); }
internal static SynchronizedField <T> Create(PNetU.NetworkView netView) { return(new SynchronizedField <T>(netView)); }