- Home /
Editor Script to place prefabs with some variance
Hello all,
The end game is to effectively emulate the terrain's "place trees" tool, but outside of a terrain (for use in a mobile game). If there are easier ways other than reinventing the wheel, I'd love to hear them.
Anyway, the question is how to instantiate a prefab with some variation when clicking on an object in a specific layer. By that, I mean I want to simply select my prefab from the Project View, then click on my ground object (which would consequently be in a Layer defined as "Terrain" or whatever) in the Scene View. This would instantiate the selected prefab, giving it some variation in rotation, size, and bend that could be adjusted via window or by simply editing the script's code (I don't care).
Any ideas on how to:
-Instantiate the selected prefab
-Define a coordinate in world coordinates when clicking on an object in the scene view
`
Also, does anyone know of where to find any editor scripts that I could learn from?
Cheers,
Unislash
Your answer
Follow this Question
Related Questions
instantiate a prefab from array and then changing it 1 Answer
How can I Instantiate an Object from a Randomly Selected Index in an Array of Game Objects? 1 Answer
For Loop isn't working properly! 1 Answer
Creating a light in game C# 1 Answer
Random.value sometimes doesn't instantiate my prefab(pic included) 1 Answer