Hello,
So, I’m using a sprite that is a tree top in order to decorate my environment.
I would like to know if there is a way to code something in the inspector so that when click and drag the sprite, it will randomize the size and color (previously defined values), so that I dont have to copy them then change those settings manually.
(I dont want to do that at run time! It is only a “builder tool”)
You can do that with a custom editor for your script. I’m not sure you can call a method upon drag/drop (probably can), but you can easily create a button to randomize the values via script. I haven’t worked with custom editors much so will defer to others for advice 
1 Like
You can really do all kinds of whacky things at editor time… pretty much almost everything you can do at runtime.
For instance you could put a single tree sprite somewhere then have a button to “spread a bunch of these randomly around here” or “randomly in this rectangular area,” then tune them by hand and press save on the scene.
You can do this with OnValidate() functions I believe, or just do it by selecting stuff in scene and running your code. It can be as simple as decorating a static function with [MenuItem(“Do it”)] and then iterating the Selected property and doing your thing.
1 Like
Okay, will take a look at that. Thanks!