Skip to content

Instantly share code, notes, and snippets.

@gekidoslair
Created November 10, 2019 17:13
Show Gist options
  • Save gekidoslair/359535dd108ce3dfac6b564ad37e42fe to your computer and use it in GitHub Desktop.
Save gekidoslair/359535dd108ce3dfac6b564ad37e42fe to your computer and use it in GitHub Desktop.
Adds 'Create Empty at Root' shortcut for the GameObject / right-click context menu to create an empty gameobject at 0,0,0
using UnityEditor;
using UnityEngine;
namespace MWU.Shared.Utilities
{
public class CreateEmptyAtRoot : MonoBehaviour
{
[MenuItem("GameObject/Create Empty at Root", false, 0)]
public static void Create()
{
var go = new GameObject();
go.name = "GameObject";
go.transform.position = Vector3.zero;
go.transform.rotation = Quaternion.identity;
}
}
}
@gekidoslair
Copy link
Author

I added this to a utilities package that is available here:
https://github.com/PixelWizards/com.pixelwizards.utilities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment