Hi guys, I was wondering how to instantiate an object from the Editor in the center of the View “Scene” screen.
string path = "Assets/Resources/teleports/updated/Teleport.prefab";
GameObject go = AssetDatabase.LoadAssetAtPath(path, (typeof(GameObject))) as GameObject;
PrefabUtility.InstantiatePrefab(go);
go.transform.position = "center of the scene view in editor"
You could get the screen center and convert it to world position, but if you don’t have some specific floor/world plane, you have to define some distance from camera to place the object (probably not exactly where user expects) or do a raycast to get an exact hit to some world location.