Make New GameObject From Menu Spawn At Zero

Is there any way to make the “Create Empty” GameObject option in the menu (GameObject > Create Empty) spawn the new GameObject at 0,0,0 world space?

Right now it tends to spawn at some irritatingly arbitrary value, 3.3574,4.907523, that sorta thing.

Thanks!

A gameObject created using the GameObject > Create Empty will spawn in the middle of the Scene view. If you want the object to spawn at 0, 0, 0, the scene camera must point at the center of the world.

But, since, Unity is extensible, you can also create your own “Create Empty” menu item thanks to a simple script put in an Editor folder:

using UnityEngine;
using UnityEditor;

public class CreateEmptyMenu
{
    [MenuItem("GameObject/Create Centered Empty #%&n", priority = 0 )]
    public static void CreateEmpty()
    {
        GameObject empty = new GameObject("GameObject");
        Undo.RegisterCreatedObjectUndo( empty, "Create new empty" );
        Selection.objects = new Object[] { empty };
    }
}

Actually you can go to Edit → Preferences → Scene View and enable the “Create Objects At Origin” toggle. That’s it, now your empty objects are created at the scene (0,0,0)

Make one, move it to (0,0,0) give it a name like “1” to keep it at the top of the hierarchy window. Now just duplicate it whenever you need a new one(leaving the original for your next duplication). It’s what I do, if you find a better way let me know.

Does anyone know why it doesn’t spawn empty game objects at 0,0,0? It is not hard to type 0,0,0 and to make one on top of hierarchy and then copy it, but it should really spawn them at 0,0,0 or at parent’s location…

I dont think so but maybe you could expand the editor and make your own function, is it really a hassle to type 0,0,0 in the inspector though? :slight_smile: