Created
October 6, 2013 14:45
-
-
Save s2kw/6854933 to your computer and use it in GitHub Desktop.
CodeIQ presents, Unity Editor Seminar.
Question1.
I checked How to use MenuItem's 2nd argument.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
public class Question1Editor : Editor { | |
[MenuItem("Editor10/Question1")] | |
static void Question1_Basic(){} | |
[MenuItem("Editor10/Question1_ #&n",false)] | |
static bool Validateaaa() | |
{ | |
Debug.Log("Validate"); | |
return Selection.activeTransform; | |
// http://docs.unity3d.com/Documentation/ScriptReference/Selection-activeTransform.html | |
} | |
[MenuItem("Editor10/Question1_ #&n",true)] | |
static void Question1_Practical() | |
{ | |
Debug.Log("1"); | |
GameObject childObj = new GameObject(); | |
if(childObj == null) return; | |
childObj.transform.parent = Selection.activeGameObject.transform; | |
} | |
[MenuItem("Editor10/Question1_ #&n")] | |
static void Question1_Practical2() | |
{ | |
Debug.Log("2"); | |
GameObject childObj = new GameObject(); | |
if(childObj == null) return; | |
childObj.transform.parent = Selection.activeGameObject.transform; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment