public static void Restart()
    {
        var allScriptableObjects = (from t in ScriptableObjectFactory.GetAssembly().GetTypes()
                                    where t.IsSubclassOf(typeof(ScriptableObject))
                                    where !t.Name.Contains(typeof(EndNameEdit).ToString())
                                    where !t.IsSubclassOf(typeof(EditorWindow))
                                    where !t.IsAbstract
                                    where !t.IsGenericType
                                    select t).ToArray();

        Type[] allPluginScriptableObjects = new Type[0];

        Assembly pluginAssembly = ScriptableObjectFactory.GetPluginAssembly();

        if (pluginAssembly != null)
        {
            allPluginScriptableObjects = (from t in ScriptableObjectFactory.GetPluginAssembly().GetTypes()
                                          where t.IsSubclassOf(typeof(ScriptableObject))
                                          where !t.Name.Contains(typeof(EndNameEdit).ToString())
                                          where !t.IsSubclassOf(typeof(EditorWindow))
                                          where !t.Name.Contains("EndNameEdit")
                                          where !t.IsAbstract
                                          where !t.IsGenericType
                                          select t).OrderBy(s => s.Name).ToArray();
        }

        Types = allScriptableObjects.ConcatArrays(allPluginScriptableObjects).OrderBy(type => (_useNamespaces ? type.FullName : type.Name)).ToArray();
    }
コード例 #2
0
    public static void CreateScriptableObject()
    {
        // Get all classes derived from ScriptableObject
        var allScriptableObjects = (from t in ScriptableObjectFactory.GetAssembly().GetTypes()
                                    where t.IsSubclassOf(typeof(ScriptableObject))
                                    where !t.Name.Contains(typeof(EndNameEdit).ToString())
                                    where !t.IsSubclassOf(typeof(EditorWindow))
                                    where !t.IsAbstract
                                    where !t.IsGenericType
                                    select t).ToArray();

        Type[] allPluginScriptableObjects = new Type[0];

        Assembly pluginAssembly = ScriptableObjectFactory.GetPluginAssembly();

        if (pluginAssembly != null)
        {
            allPluginScriptableObjects = (from t in ScriptableObjectFactory.GetPluginAssembly().GetTypes()
                                          where t.IsSubclassOf(typeof(ScriptableObject))
                                          where !t.Name.Contains(typeof(EndNameEdit).ToString())
                                          where !t.IsSubclassOf(typeof(EditorWindow))
                                          where !t.IsAbstract
                                          where !t.IsGenericType
                                          select t).OrderBy(s => s.Name).ToArray();
        }

        // Show the selection window.
        ScriptableObjectFactoryWindow.Init(allScriptableObjects.ConcatArrays(allPluginScriptableObjects));
    }
コード例 #3
0
        public static void CreateAsset()
        {
            GameResources gameResources = ScriptableObjectFactory.CreateInstance <GameResources>();

            AssetDatabase.CreateAsset(gameResources, AssetPath);
            EditorUtility.DisplayDialog("Asset Created", string.Format("Asset has been added at '{0}'", AssetPath),
                                        "OK");
        }