public UnityObject RetrieveObjectReference(int storageId) { if (SerializedObjects == null) { throw new InvalidOperationException("SerializedObjects cannot be null"); } // The storageId is invalid; we can only return null. if (storageId < 0 || storageId >= SerializedObjects.Count) { return(null); } fiUnityObjectReference found = SerializedObjects[storageId]; // Unity is funny; it overrides null so such that // ReferenceEquals(found, null) can return false when found == null // is true. If the serialized value became null (such as when it // becomes a prefab and references a non-prefab object), we want to // return the actual, correct, proper null value, instead of some // whatever magical thing. The bad null value will cause property // assignment exceptions (because it is of type // UnityEngine.Component) if (found == null || found.Target == null) { return(null); } return(found.Target); }
public static void Reset(fiUnityObjectReference target) { if (s_metadata.ContainsKey(target)) { s_metadata.Remove(target); fiLateBindings.EditorApplication.InvokeOnEditorThread(() => { for (int i = 0; i < s_providers.Length; ++i) { s_providers[i].Reset(target); } }); } }
public static void Reset(UnityObject target_) { var target = new fiUnityObjectReference(target_); if (s_metadata.ContainsKey(target)) { s_metadata.Remove(target); for (int i = 0; i < s_providers.Length; ++i) { s_providers[i].Reset(target.Target); } } }
public static fiGraphMetadata GetMetadataFor(fiUnityObjectReference target) { fiGraphMetadata metadata; if (s_metadata.TryGetValue(target, out metadata) == false) { // Make sure that we update the s_metadata instance for target before initializing all of the providers, // as some of the providers may recurisvely call into this method to fetch the actual fiGraphMetadata // instance during initialization. metadata = new fiGraphMetadata(target); s_metadata[target] = metadata; for (int i = 0; i < s_providers.Length; ++i) { s_providers[i].RestoreData(target); } } return(metadata); }
public fiGraphMetadata(fiUnityObjectReference targetObject) : this(null, string.Empty) { _targetObject = targetObject; }
public static bool HasMetadata(fiUnityObjectReference target) { return(s_metadata.ContainsKey(target)); }