Just as I was about to start development for a plugin that would allow me to disable parts of a CUA, I stumbled over the collection by unique, uploaded by @trety. I played a bit with this set of plugins and got the feeling that a lot of the functionality (not all, though) could be integrated into a single plugin. So, after some coding and looking at other CUA related scripts like the one of @Sally Whitemane, lo and behold... I present to you: CUA_Editor
Add the file "CUA_Editor.cslist" to any CUA in the "Plugins" tab and you can enable/disable (also via scripting)
The plugin is initially off, so the CUA is fully there. When turning the plugin on, the blue GameObject, already set to disabled, will vanish. The red toggle now also works for the red GameObject.
The two toggles below address only the renderer / the collider components of the black GameObject.
Removing the renderer makes the black parts invisible, but leaves the collider, so the blue sphere will stay where it is initially.
Removing the collider will cause the blue sphere to move to it's target position which is intersecting the black handle, but the "visible" part of the handle stays.
The plugin UI is fairly compact and self explanatory. The top left "Filter" section has a drop-down to choose which kind of CUA components you are dis/enabling. You can also enter a name (or a RegEx if you know the power of those) and get only the elements filtered by name, e.g., to search for everything with "tree" in it. Also, since v1.4, hovering over a toggle will make the corresponding GameObject flash, and it's bounding box will appear (e.g., in the screenshot below, the red pillow named Cube.023).
Depending on the design of the CUA, the names in the toggles can get very long, but the UI will (within reason) adapt by changing the font size. You can also click "Copy CUA Structure to Clipboard", and it will log the whole CUA structure tree to the console and copy it into the clipboard, so you can use an editor to look at the data in detail.
"Enable/Disable All" applies to all toggles currently listed on the page.
Then there are two "Destroy" options, which theoretically should delete the disabled GameObjects to totally remove them from the game engine and theoretically gain some FPS. In practice, I have noticed that after a "Destroy", the next scene load will stall indefinitely, so something is still off, and I recommend NOT using a) the checkbox "destroy on load" and the "Destroy Disabled GameObjects" button!!!!!!!!
Known Bug:
Credits:
Thanks to unique / @trety and @Sally Whitemane for their CUA plugins that served as code "seedlings".
Thanks to @TacoCat for the TCCarchive, from which I borrowed one of the smallest CUAs I could find to a) not create any dependency and b) not blow up the VAR file too much.
Thanks to @MacGruber for the bread-and-butter code Utils.cs and LogicBricks.
Add the file "CUA_Editor.cslist" to any CUA in the "Plugins" tab and you can enable/disable (also via scripting)
- any GameObject (including all components like mesh renderer and colliders, as well as linked objects in the hierarchy),
- one or more mesh renderers,
- one or more colliders,
- light sources,
- audio sources,
- light probe groups,
- reflection probes.
The plugin is initially off, so the CUA is fully there. When turning the plugin on, the blue GameObject, already set to disabled, will vanish. The red toggle now also works for the red GameObject.
The two toggles below address only the renderer / the collider components of the black GameObject.
Removing the renderer makes the black parts invisible, but leaves the collider, so the blue sphere will stay where it is initially.
Removing the collider will cause the blue sphere to move to it's target position which is intersecting the black handle, but the "visible" part of the handle stays.
The plugin UI is fairly compact and self explanatory. The top left "Filter" section has a drop-down to choose which kind of CUA components you are dis/enabling. You can also enter a name (or a RegEx if you know the power of those) and get only the elements filtered by name, e.g., to search for everything with "tree" in it. Also, since v1.4, hovering over a toggle will make the corresponding GameObject flash, and it's bounding box will appear (e.g., in the screenshot below, the red pillow named Cube.023).
Depending on the design of the CUA, the names in the toggles can get very long, but the UI will (within reason) adapt by changing the font size. You can also click "Copy CUA Structure to Clipboard", and it will log the whole CUA structure tree to the console and copy it into the clipboard, so you can use an editor to look at the data in detail.
"Enable/Disable All" applies to all toggles currently listed on the page.
Then there are two "Destroy" options, which theoretically should delete the disabled GameObjects to totally remove them from the game engine and theoretically gain some FPS. In practice, I have noticed that after a "Destroy", the next scene load will stall indefinitely, so something is still off, and I recommend NOT using a) the checkbox "destroy on load" and the "Destroy Disabled GameObjects" button!!!!!!!!
Known Bug:
- (Not really a bug, but something to keep in mind): When pressing "Rescan CUA", after having edited/toggled elements (for which there should actually be no need to), saving the scene will NOT save those edited elements (as the rescan will make the plugin think, those settings are the new default, and only toggles that are different from the defaults are saved).
In order to reset everything without losing your changes, click "Save Configuration to Clipboard", briefly choose "None" as a CUA, then the correct CUA again, and click "Load Configuration from Clipboard".
Credits:
Thanks to unique / @trety and @Sally Whitemane for their CUA plugins that served as code "seedlings".
Thanks to @TacoCat for the TCCarchive, from which I borrowed one of the smallest CUAs I could find to a) not create any dependency and b) not blow up the VAR file too much.
Thanks to @MacGruber for the bread-and-butter code Utils.cs and LogicBricks.
It's also not always straightforward as not every visible thing has a clear cut hitbox around it that one could do a raycast against.