From 0661a258e230ed3b07aa6a2be373ce2725d9d9d7 Mon Sep 17 00:00:00 2001 From: Lior Tal Date: Fri, 5 Jun 2015 11:32:01 +0300 Subject: [PATCH 1/5] Add .gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..991760a --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/Library + +/Temp +*.csproj +*.sln +*.userprefs From 48d9735081596b974f5a6f4eda570f75927609af Mon Sep 17 00:00:00 2001 From: Lior Tal Date: Thu, 19 Nov 2015 08:26:48 +0200 Subject: [PATCH 2/5] Remove unneeded files --- .gitignore | 2 +- Assembly-CSharp-Editor-vs.csproj | 74 -------------------------------- Assembly-CSharp-Editor.csproj | 74 -------------------------------- Assembly-CSharp-vs.csproj | 64 --------------------------- Assembly-CSharp.csproj | 64 --------------------------- 5 files changed, 1 insertion(+), 277 deletions(-) delete mode 100644 Assembly-CSharp-Editor-vs.csproj delete mode 100644 Assembly-CSharp-Editor.csproj delete mode 100644 Assembly-CSharp-vs.csproj delete mode 100644 Assembly-CSharp.csproj diff --git a/.gitignore b/.gitignore index 991760a..cc11e4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /Library - +obj/ /Temp *.csproj *.sln diff --git a/Assembly-CSharp-Editor-vs.csproj b/Assembly-CSharp-Editor-vs.csproj deleted file mode 100644 index 7e4e721..0000000 --- a/Assembly-CSharp-Editor-vs.csproj +++ /dev/null @@ -1,74 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE} - Library - Properties - - Assembly-CSharp-Editor - v3.5 - 512 - Assets - - - true - full - false - Temp\bin\Debug\ - DEBUG;TRACE;UNITY_4_6_0;UNITY_4_6;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN - prompt - 4 - 0169 - - - pdbonly - true - Temp\bin\Release\ - TRACE - prompt - 4 - 0169 - - - - - - - - D:/Unity_46b15/Editor/Data/Managed/UnityEngine.dll - - - D:/Unity_46b15/Editor/Data/Managed/UnityEditor.dll - - - - - - - D:/Unity_46b15/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/UnityEngine.UI.dll - - - D:/Unity_46b15/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/Editor/UnityEditor.UI.dll - - - D:/Unity_46b15/Editor/Data/Managed/UnityEditor.Graphs.dll - - - - - {0C590955-EECE-1351-B315-A143BE8037B1} Assembly-CSharp-vs - - - - - diff --git a/Assembly-CSharp-Editor.csproj b/Assembly-CSharp-Editor.csproj deleted file mode 100644 index 7bd03e8..0000000 --- a/Assembly-CSharp-Editor.csproj +++ /dev/null @@ -1,74 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE} - Library - Properties - - Assembly-CSharp-Editor - v3.5 - 512 - Assets - - - true - full - false - Temp\bin\Debug\ - DEBUG;TRACE;UNITY_4_6_0;UNITY_4_6;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN - prompt - 4 - 0169 - - - pdbonly - true - Temp\bin\Release\ - TRACE - prompt - 4 - 0169 - - - - - - - - D:/Unity_46b15/Editor/Data/Managed/UnityEngine.dll - - - D:/Unity_46b15/Editor/Data/Managed/UnityEditor.dll - - - - - - - D:/Unity_46b15/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/UnityEngine.UI.dll - - - D:/Unity_46b15/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/Editor/UnityEditor.UI.dll - - - D:/Unity_46b15/Editor/Data/Managed/UnityEditor.Graphs.dll - - - - - {0C590955-EECE-1351-B315-A143BE8037B1} Assembly-CSharp - - - - - diff --git a/Assembly-CSharp-vs.csproj b/Assembly-CSharp-vs.csproj deleted file mode 100644 index 0a377a9..0000000 --- a/Assembly-CSharp-vs.csproj +++ /dev/null @@ -1,64 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {0C590955-EECE-1351-B315-A143BE8037B1} - Library - Properties - - Assembly-CSharp - v3.5 - 512 - Assets - - - true - full - false - Temp\bin\Debug\ - DEBUG;TRACE;UNITY_4_6_0;UNITY_4_6;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN - prompt - 4 - 0169 - - - pdbonly - true - Temp\bin\Release\ - TRACE - prompt - 4 - 0169 - - - - - - - - D:/Unity_46b15/Editor/Data/Managed/UnityEngine.dll - - - D:/Unity_46b15/Editor/Data/Managed/UnityEditor.dll - - - - - - - D:/Unity_46b15/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/UnityEngine.UI.dll - - - - - - diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj deleted file mode 100644 index 0a377a9..0000000 --- a/Assembly-CSharp.csproj +++ /dev/null @@ -1,64 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {0C590955-EECE-1351-B315-A143BE8037B1} - Library - Properties - - Assembly-CSharp - v3.5 - 512 - Assets - - - true - full - false - Temp\bin\Debug\ - DEBUG;TRACE;UNITY_4_6_0;UNITY_4_6;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN - prompt - 4 - 0169 - - - pdbonly - true - Temp\bin\Release\ - TRACE - prompt - 4 - 0169 - - - - - - - - D:/Unity_46b15/Editor/Data/Managed/UnityEngine.dll - - - D:/Unity_46b15/Editor/Data/Managed/UnityEditor.dll - - - - - - - D:/Unity_46b15/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/UnityEngine.UI.dll - - - - - - From ffa457fe21519047aebf99132793db3e8d49e811 Mon Sep 17 00:00:00 2001 From: Lior Tal Date: Thu, 19 Nov 2015 08:27:01 +0200 Subject: [PATCH 3/5] Minor cleaning to code --- Assets/Editor/ScriptableObjectFactory.cs | 11 +++-------- Assets/Editor/ScriptableObjectWindow.cs | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Assets/Editor/ScriptableObjectFactory.cs b/Assets/Editor/ScriptableObjectFactory.cs index a0492cf..6692bf3 100644 --- a/Assets/Editor/ScriptableObjectFactory.cs +++ b/Assets/Editor/ScriptableObjectFactory.cs @@ -1,18 +1,16 @@ using System; -using System.Collections; using System.Linq; using System.Reflection; using UnityEditor; using UnityEngine; /// -/// Helper class for instantiating ScriptableObjects. +/// A helper class for instantiating ScriptableObjects in the editor. /// public class ScriptableObjectFactory { - [MenuItem("Project/Create/ScriptableObject")] [MenuItem("Assets/Create/ScriptableObject")] - public static void Create() + public static void CreateScriptableObject() { var assembly = GetAssembly (); @@ -22,10 +20,7 @@ where t.IsSubclassOf(typeof(ScriptableObject)) select t).ToArray(); // Show the selection window. - var window = EditorWindow.GetWindow(true, "Create a new ScriptableObject", true); - window.ShowPopup(); - - window.Types = allScriptableObjects; + ScriptableObjectWindow.Init(allScriptableObjects); } /// diff --git a/Assets/Editor/ScriptableObjectWindow.cs b/Assets/Editor/ScriptableObjectWindow.cs index 6b7edc0..0e6bc1f 100644 --- a/Assets/Editor/ScriptableObjectWindow.cs +++ b/Assets/Editor/ScriptableObjectWindow.cs @@ -21,11 +21,11 @@ public override void Action (int instanceId, string pathName, string resourceFil public class ScriptableObjectWindow : EditorWindow { private int selectedIndex; - private string[] names; + private static string[] names; - private Type[] types; + private static Type[] types; - public Type[] Types + private static Type[] Types { get { return types; } set @@ -34,7 +34,15 @@ public Type[] Types names = types.Select(t => t.FullName).ToArray(); } } - + + public static void Init(Type[] scriptableObjects) + { + Types = scriptableObjects; + + var window = EditorWindow.GetWindow(true, "Create a new ScriptableObject", true); + window.ShowPopup(); + } + public void OnGUI() { GUILayout.Label("ScriptableObject Class"); From bce8af94a5d021f202c1f10cff0571f1d5f5926e Mon Sep 17 00:00:00 2001 From: Lior Tal Date: Thu, 19 Nov 2015 08:40:53 +0200 Subject: [PATCH 4/5] Remove tracking from .sln files --- ScriptableObjects-csharp.sln | 45 ------------------------------------ ScriptableObjects.sln | 45 ------------------------------------ 2 files changed, 90 deletions(-) delete mode 100644 ScriptableObjects-csharp.sln delete mode 100644 ScriptableObjects.sln diff --git a/ScriptableObjects-csharp.sln b/ScriptableObjects-csharp.sln deleted file mode 100644 index ed8d0e1..0000000 --- a/ScriptableObjects-csharp.sln +++ /dev/null @@ -1,45 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2008 - -Project("{E725F106-9BD1-43A2-2050-5BF13E9EFB89}") = "ScriptableObjects", "Assembly-CSharp-vs.csproj", "{0C590955-EECE-1351-B315-A143BE8037B1}" -EndProject -Project("{E725F106-9BD1-43A2-2050-5BF13E9EFB89}") = "ScriptableObjects", "Assembly-CSharp-Editor-vs.csproj", "{26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0C590955-EECE-1351-B315-A143BE8037B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C590955-EECE-1351-B315-A143BE8037B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C590955-EECE-1351-B315-A143BE8037B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C590955-EECE-1351-B315-A143BE8037B1}.Release|Any CPU.Build.0 = Release|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = Assembly-CSharp.csproj - Policies = $0 - $0.TextStylePolicy = $1 - $1.inheritsSet = null - $1.scope = text/x-csharp - $0.CSharpFormattingPolicy = $2 - $2.inheritsSet = Mono - $2.inheritsScope = text/x-csharp - $2.scope = text/x-csharp - $0.TextStylePolicy = $3 - $3.FileWidth = 120 - $3.TabWidth = 4 - $3.EolMarker = Unix - $3.inheritsSet = Mono - $3.inheritsScope = text/plain - $3.scope = text/plain - EndGlobalSection - -EndGlobal diff --git a/ScriptableObjects.sln b/ScriptableObjects.sln deleted file mode 100644 index 4e2f9c8..0000000 --- a/ScriptableObjects.sln +++ /dev/null @@ -1,45 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2008 - -Project("{E725F106-9BD1-43A2-2050-5BF13E9EFB89}") = "ScriptableObjects", "Assembly-CSharp.csproj", "{0C590955-EECE-1351-B315-A143BE8037B1}" -EndProject -Project("{E725F106-9BD1-43A2-2050-5BF13E9EFB89}") = "ScriptableObjects", "Assembly-CSharp-Editor.csproj", "{26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0C590955-EECE-1351-B315-A143BE8037B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C590955-EECE-1351-B315-A143BE8037B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C590955-EECE-1351-B315-A143BE8037B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C590955-EECE-1351-B315-A143BE8037B1}.Release|Any CPU.Build.0 = Release|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26B2E2A7-DB38-FDBD-E6E2-42C94E7891CE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = Assembly-CSharp.csproj - Policies = $0 - $0.TextStylePolicy = $1 - $1.inheritsSet = null - $1.scope = text/x-csharp - $0.CSharpFormattingPolicy = $2 - $2.inheritsSet = Mono - $2.inheritsScope = text/x-csharp - $2.scope = text/x-csharp - $0.TextStylePolicy = $3 - $3.FileWidth = 120 - $3.TabWidth = 4 - $3.EolMarker = Unix - $3.inheritsSet = Mono - $3.inheritsScope = text/plain - $3.scope = text/plain - EndGlobalSection - -EndGlobal From 67fae752b689ec152d22417241f1bcf9f3154319 Mon Sep 17 00:00:00 2001 From: Lior Tal Date: Thu, 19 Nov 2015 08:53:30 +0200 Subject: [PATCH 5/5] Create README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4c71da2 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# ScriptableObjectFactory +A Unity editor extension for creating any ScriptableObject type + +Download as a .UnityPackage: [ScriptableObjectFactory](https://www.dropbox.com/s/vdvf5si4go3jnb5/ScriptableObjectFactory.unitypackage) + +Originally introduced in this [Blog Post](http://www.tallior.com/unity-scriptableobject-factory/?utm_source=github&utm_medium=readme&utm_campaign=link)