Quick question about editor shortcuts/macros/scripting.

Hi all! Just wanted to check with those more knowledgeable than myself on the best way to handle something. I have some tasks in the editor that I do frequently and was hoping to find the best way to handle them more efficiently.

Some examples are:

  • toggling the alpha on a set of materials to make them visible/not visible.
  • scrolling through a list of 10 cameras, keeping only one active at a time.
  • moving a gameobject around to a handful of set positions/rotations.

I assume the best way to handle this is to learn how to create custom editor scripts? I just wanted to make sure there wasn’t an obvious “easier” solution, like some sort of macro recorder or utilizing the shortcut manager. (Or if there’s an asset that can assist with this!)
Just for additional clarification, I’m referring to editor specific tasks and not during runtime.
Thanks!

Yes, editor scripts are probably the answer here.

But tackle it from a de-minimus (eg, just what you need) approach first because there are some gotchas.

For instance, with the first one, if you wiggle a Material’s alpha, you are actually changing the asset on disk, generally speaking.

If you do it in code you must make sure you grab the .sharedMaterial on the Renderer(s) involved, or else you’ll start leaking meshes at editor time. I think Unity will tell you but not sure…

Same with the others in the sense that they change the state of your scene, which will be written the next time you save the scene, so make sure your runtime logic can tolerate whatever state the scene is in.

Avoid that! You may end up making a build with an invisible material.

The better alternative (once you have an editor script) is to get the object’s renderer and set its enabled property to false so it won’t render, but still run all the scripts and collide and so on.

And be sure to check the asset store. Pretty sure what you want to do is already available as some kind of asset, possibly even free. :wink:

Thanks for the feedback everyone! I was hoping there would be a “simple” macro recorder of some sort but it sounds like editor scripts are my best bet!