Hello, I am working on a simple waypoint system that I’m planning to use for our game and also release it for free so everyone else use it too.
Now because of that I need to make it a little bit more intuitive and write a custom inspector for the system as well but first I need to be able to check several things.
The waypoints of the waypoint system have @script ExecuteInEditMode(); so they execute in the editor. I need to check if an object is selected in the editor. Unfortunately I couldn’t find any information about that and I’m doubting this is even possible.
So is it possible to check in Javascript if an object is selected in the editor or not ?
Thanks in advance !
Great! I think this is exactly what I am after. But I got another question (sorry, I’m new to editor extensions and though I’ve read the documentation, until I get some practice things won’t be so clear for me) :
I got this hierarchy:
WaypointSystem
- Waypoint1
- Waypoint2
- WaypointN
I can have several waypoint systems in one scene with multiple waypoints. When you select the waypoint system, the inspector is going to fill with tools that will enable the person who’s using it to make different types of modifications to the waypoints. Can I use this script (the WaypointSystem script) as editor script and ingame component as well? I want to use it in the editor to edit the waypoints and ingame to call functions that return different waypoints. Will this be okay or I’ll have to make another component to use during game runtime ?
You’ll have to split that into two scrips, one for runtime and one for the editor. Editor scripts do not go into your final build, so put all the functionality for waypoint manipulation which has to be available in your game inside the waypoint system component and everything else in the editor script, the waypoint system inspector.