MccDev260 / com.mccdev260.gizmo-tool

Unity editor tool for working with gizmos.
MIT License
0 stars 0 forks source link

Cleanly extending the drawer to react to runtime code. #10

Open MccDev260 opened 2 days ago

MccDev260 commented 2 days ago

I want to extend this package so it's able to react to runtime code in the editor while still isolating it from builds.

Let's say we have a complex camera transition sequence and we want to visualise the location of each camera with our gizmo tool; That is simple to set up in the project's current state. If we now wanted to visualise which camera is active by changing the camera gizmos colour, things can start to get a little messy.

Since broadcasters don't care who's subscribed to them, one solution is to set the drawer up with some public methods to handle property value changes, then add the drawer as a listener to a Unity Event This should mean that when the project is built and this package no longer exists, nothing should break.

v1.1.1 makes a start testing this with a public method to change the gizmo colour.

MccDev260 commented 2 days ago

The above solution ends up littering the code with #If UNITY EDITOR tags and managing states becomes too tightly coupled. I'm going to test using an interface that will live in the runtime folder instead since the implementation is agnostic to the call.