Adding the "Actions on trigger" menu in plugin GUI

mrmr32

Well-known member
Messages
123
Reactions
316
Points
63
Website
github.com
Patreon
mrmr32
I want to add actions when a internal script event happens, and I thought using the already existing VAM trigger GUI will be the easiest way to do it.
In particular I need this part of the CollisionTrigger/LookAtTrigger (add actions & edit them):
img.jpg


I've been searching for almost a week now, and still nothing. I think that what I need is to save a Trigger variable inside the script, but in order to call InitTriggerUI()* the UITransform needs a TriggerUI (and with GameObject#AddComponent<TriggerUI>() it stills shows as null).

* In LookAtTrigger, inside InitUI, it performs this initialization:
C#:
LookAtTriggerUI componentInChildren = this.UITransform.GetComponentInChildren<LookAtTriggerUI>();
...
this.trigger.triggerActionsParent = componentInChildren.transform;
this.trigger.triggerPanel = componentInChildren.transform;
this.trigger.triggerActionsPanel = componentInChildren.transform;
this.trigger.InitTriggerUI();
this.trigger.InitTriggerActionsUI();
 
or for more stuff to help with plugin UI in general you should check MacGruber's Macgruber_Utils.cs from LogicBricks, he's been awesome enough to make & share that with other plugin makers

I hope this collection will grow eventually as I need little plugins when building demo scenes for other plugins. Maybe other creators chime in and build compatible plugins using the same EventTrigger system. If you are a creator, check out the included MacGruber_Utils.cs, which handles the needed building of custom UI for the trigger screen, internal handling of AssetBundles as well as scene load/save for you. The actual plugin can be comparatively simple, you only need to hook my wrapper code in, which is essentially copy&paste from my plugin. The Utils class also helps with creating sliders, buttons, etc. for your plugin UI.

if you check one of his logicbricks like RandomDelay it's essentially just a trigger plus the random delay part before calling the trigger
 
I decided to use Macgruber_Utils.cs. Easier to use, cleaner GUI, and you can see how it is used in the plugin itself.
Thanks for all, you saved me!
 
Back
Top Bottom