Hi there, I have a lot of levels to build by dragging & dropping prefabs from the project pane to the editor. These assets are balls that have their pivots at the center. However, i'd like to place them on top of a surface and they're always half stuck in the ground when I move them on the surface so I always have to incase the Y position for each object i drag in.
Is there a way to place the objects on the surface without being stuck?
asked Dec 12 '11 at 08:55 PM
Make a script, and set it to run in Edit mode: http://unity3d.com/support/documentation/ScriptReference/ExecuteInEditMode.html
In the Start function, set the Y position. If you just have a flat plane, it would be a constant, but if it's a variable surface, you can cast a ray down to find the floor.
Attach it to your prefab.
Have this just run in the editor. You can comment it out or remove it for run-time. But it should help you with initial placement.