Prefab transform

How can I force instance of my prefab to use its prefab’s transform values?
For example I have the prefab with transform.position = (0, 0, 0);
When I drag this prefab into the Scene I set new position values for an instance (and its usually ok).
But I want this instance (after I drop it on the Scene) to use its prefabs position = (0, 0, 0), for example.
How can I implement this?

Just drag it to the hierarchy instead of the scene view. When dropping into the scene view, it tries to use the position you drop at, to be helpful, but if you just drop into the hierarchy instead, it just copies the prefab's values!

You can accomplish the same with Instantiate() by using the prefab reference's transform values, like this...

Instantiate(myPrefab,myPrefab.transform.position,myPrefab.transform.rotation);

Of course, if your position and rotation are just zeroed out, it would be just as easy to use the constants Vector3.zero and Quaternion.identity rather than look up the transform's values.

here’s a way.

using UnityEditor;

[CustomEditor(typeof(GameObject))]
public class ObjectsEditorScript : Editor {

    GameObject gameObject;

    void OnEnable() {
	    gameObject = (GameObject)target;
	
	    Vector3 pos = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition).origin;
	    pos.z = [the z value you want];
	    gameObject.transform.position = pos;
    }

}

script file has to be in “Editor” folder