Initial commit
This commit is contained in:
42
Assets/UnityChan/Editor/CreateLocatorHere.cs
Normal file
42
Assets/UnityChan/Editor/CreateLocatorHere.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
//CreateLocatorHere.cs
|
||||
//
|
||||
//Original Script is here (JavaScript):
|
||||
//http://answers.unity3d.com/questions/7755/how-do-i-create-a-new-object-in-the-editor-as-a-ch.html
|
||||
//
|
||||
//CS Version made by N.Kobayashi 2014/06/14
|
||||
//
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityChan
|
||||
{
|
||||
public class CreateLocatorHere
|
||||
{
|
||||
// Add menu to the main menu
|
||||
[MenuItem("GameObject/Create Locator Here")]
|
||||
static void CreateGameObjectAsChild ()
|
||||
{
|
||||
GameObject go = new GameObject ("Locator_");
|
||||
go.transform.parent = Selection.activeTransform;
|
||||
go.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
|
||||
// The item will be disabled if no transform is selected.
|
||||
[MenuItem("GameObject/Create Locator Here",true)]
|
||||
static bool ValidateCreateGameObjectAsChild ()
|
||||
{
|
||||
return Selection.activeTransform != null;
|
||||
}
|
||||
|
||||
// Add context menu to Transform's context menu
|
||||
[MenuItem("CONTEXT/Transform/Create Locator Here")]
|
||||
static void CreateGameObjectAsChild (MenuCommand command)
|
||||
{
|
||||
Transform tr = (Transform)command.context;
|
||||
GameObject go = new GameObject ("Locator_");
|
||||
go.transform.parent = tr;
|
||||
go.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Assets/UnityChan/Editor/CreateLocatorHere.cs.meta
Normal file
10
Assets/UnityChan/Editor/CreateLocatorHere.cs.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12ec17992da8868439a50d4b342b7cfd
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user