ActionCreatorMenu.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. namespace ShadowKit.Action
  6. {
  7. public class ActionCreatorMenu : Editor {
  8. //// [MenuItem("Tools/ShadowCreator/Air")]
  9. // public static void createAir()
  10. // {
  11. // GameObject added = GameObject.Find ("ShadowSystem");
  12. // GameObject obj;
  13. // GameObject sel;
  14. // if (added == null) {
  15. // obj = (GameObject)Resources.Load ("Prefabs/ShadowSystem");
  16. // sel = (GameObject)Instantiate (obj);
  17. // sel.name = "ShadowSystem";
  18. // }
  19. // added = GameObject.Find ("AirSystem");
  20. // if (added == null) {
  21. // obj = (GameObject)Resources.Load ("Prefabs/AirSystem");
  22. // sel = (GameObject)Instantiate (obj);
  23. // sel.name = "AirSystem";
  24. // }
  25. // }
  26. [MenuItem("Tools/ShadowSystem")]
  27. public static void createAction()
  28. {
  29. GameObject added = GameObject.Find ("ShadowSystem");
  30. GameObject obj;
  31. GameObject sel;
  32. if (added != null) {
  33. DestroyImmediate (added);
  34. }
  35. obj = (GameObject)Resources.Load ("Prefabs/ShadowSystem");
  36. sel = (GameObject)Instantiate (obj);
  37. sel.name = "ShadowSystem";
  38. //added = GameObject.Find ("ActionSystem");
  39. //if (added != null) {
  40. // DestroyImmediate (added);
  41. //}
  42. //obj = (GameObject)Resources.Load ("Prefabs/ActionSystem");
  43. //sel = (GameObject)Instantiate (obj);
  44. //sel.name = "ActionSystem";
  45. }
  46. // [MenuItem("ShadowCreator/Objects/Window")]
  47. // public static void createWindow()
  48. // {
  49. // GameObject obj = (GameObject)Resources.Load ("Prefabs/Window");
  50. // Instantiate (obj);
  51. // var select = obj.gameObject;
  52. // Material material = new Material(Shader.Find("Standard"));
  53. // var pb = PrefabUtility.GetPrefabParent (select);
  54. // if (pb == null) {
  55. // return;
  56. // }
  57. // PrefabUtility.DisconnectPrefabInstance(select);
  58. // Selection.activeGameObject = null;
  59. // var prefab = PrefabUtility.CreateEmptyPrefab("Assets/empty.prefab");
  60. // PrefabUtility.ReplacePrefab(select, prefab, ReplacePrefabOptions.ConnectToPrefab);
  61. // PrefabUtility.DisconnectPrefabInstance(select);
  62. // }
  63. //
  64. // [MenuItem("ShadowCreator/Objects/Panel")]
  65. // public static void creatorPanel()
  66. // {
  67. // GameObject btn = (GameObject)Resources.Load ("Prefabs/Panel");
  68. // Instantiate (btn);
  69. // var select = btn.gameObject;
  70. // Material material = new Material(Shader.Find("Standard"));
  71. // var pb = PrefabUtility.GetPrefabParent (select);
  72. // if (pb == null) {
  73. // return;
  74. // }
  75. // PrefabUtility.DisconnectPrefabInstance(select);
  76. // Selection.activeGameObject = null;
  77. // var prefab = PrefabUtility.CreateEmptyPrefab("Assets/empty.prefab");
  78. // PrefabUtility.ReplacePrefab(select, prefab, ReplacePrefabOptions.ConnectToPrefab);
  79. // PrefabUtility.DisconnectPrefabInstance(select);
  80. // }
  81. }
  82. }