Changing a Prefabs Origin

Hi all,

I’m a big fan of the new prefab editing. In my workflow its been excellent but one thing has me stumped. I have a small forest prefab that I’ve created creating an empty GameObject and dragging my tree model into it three times. I can then scale the different trees to give some variety and all is fine. However, when my map builder places the forest onto game tiles its not quite in the correct place. I would have thought I could just go back into my prefab and move the trees slightly (ie relative to the prefab editor’s origin). I can see the transform value change to reflect the new offset, but when instances are placed in the scene by the map builder they ignore the fact that the objects have been offset within the prefab.

Hope this makes sense and if any one can throw some light on it, it would be greatly appreciated.

Prefabs doesn’t have an origin. They have a “position”, which is kinda weird - it’s where they get positioned in the world if you instantiate them without setting a position.
So there’s no “origin” concept in a prefab, just like any other GameObject. Things gets positioned exactly where you put them, and offsets are either due to child objects being moved relative to the parent, or because the mesh contains offsets.

Does your prefab have a mesh on it’s root? If that’s the case, you can either modify the mesh’ origin, or recreate the prefab with an empty root object so you can position the children relatively.

2 Likes

Okay so what point in a prefab does the position refer to? Is it always the center?

It’s more that prefabs have a GameObject at the root so components can be attached to it, and GameObjects have Transforms, which has a position. It’s very uncommon to want to have something that’s both a prefab and something you want to only have one specific position, so idk, why are you asking? The thread is 5 years old, lol.