// Methods /// <summary> /// Called by Unity while in editor mode. /// Allows the unique id to be generated when the script is attached to an object. /// </summary> public virtual void Reset() { // Generate the unique id if required - This is requried for objects instantiated during replay //replayIdentity.Generate(); // Try to find a parent replay object or create one if required #if UNITY_EDITOR // Check for ignored components if (GetType().IsDefined(typeof(ReplayIgnoreAttribute), true) == true) { return; } ReplayObject manager = GetManagingObject(); // Create a manager component if (manager == null) { manager = Undo.AddComponent <ReplayObject>(gameObject); } // Force rebuild the component list if (manager != null) { manager.RebuildComponentList(); } #endif }