public static ScriptAsset Create(System.Type type) { ScriptAsset instance = CreateInstance(type) as ScriptAsset; instance.Construct(); return(instance); }
/// <summary> /// When someone calls GetInitialized of a script asset, we're receiving /// a call to this method - finding and returning the current state of /// the script. /// </summary> /// <param name="scriptAsset">Script asset to find state for.</param> /// <returns>Current state of the script asset.</returns> public InitializationState Report(ScriptAsset scriptAsset) { if (scriptAsset == null) { throw new ArgumentNullException("scriptAsset"); } if (m_activeScriptAssets.Contains(scriptAsset)) { return(InitializationState.Initialized); } // Adding the script asset to active but it hasn't been // initialized yet - assuming script asset base class // to unregister itself if initialization fails. m_activeScriptAssets.Add(scriptAsset); return(InitializationState.NotInitialized); }
/// <summary> /// Unregister initialized script asset. /// </summary> /// <param name="scriptAsset"></param> public void Unregister(ScriptAsset scriptAsset) { m_activeScriptAssets.Remove(scriptAsset); }