In the VTI World Kit, a Driver is a script that acts as an "Endpoint" for when an Event is received and fired. When attached to the same GameObject as a VTITarget component, it will receive Event data when said target is Fired by VTI.
Multiple Drivers can exist under the same Target, allowing multiple actions to be taken upon firing without needing a bespoke custom Driver.
All Drivers are, and must be, derived from the VTIDriverBase
base class. The base class includes all the below properties and methods when inherited.
Properties
Property | Type | Usage |
---|---|---|
UserName | string | The Twitch User Name of the user who triggered this Event. |
Message | string | The User Message, if applicable, that was sent with this Event. |
TriggerCause | string | The reason why this was triggered. Use this when Allow Event Type Rebinding is enabled on the VTITarget to dynamically handle user-changed bindings. |
TriggerAmount | int | What "value" is associated with this Event, i.e. how many bits cheered, subs gifted, tier subscribed, etc. |
IsReady | bool | A helper variable to easily mark a Driver as "busy" and unable to refire. Unless overridden in the derived Driver, VTICheckReady() will default to just returning this value.
|
Methods
Method | Return | Usage |
---|---|---|
VTICheckReady() | bool | This method will be called by VTI just before attempting to fire the parent VTITarget. Return true if this is ready to be fired.
|
VTIEventPlay() | void | This method will be called by VTI when its parent VTITarget is Fired. |
Packaged Drivers
Driver | Usage |
---|---|
VTIAnimTrigger | Sets an Animator's Trigger input when Fired. |
VTIObjectToggle | When Fired, this Driver will enable the target GameObject, wait for ResetTime seconds, and then optionally disable it again.
|
VTIObjectInstantiate | Will instantiate a prefab copy when fired within a certain (zero-able) range of either the Streamer or the Target. These copies are not syncable, so do not use them for persistent items. |
VTIRadialTripObjectToggle | A version of VTIObjectToggle that will "arm" when Fired, and then wait for a Player to get within a set radius before enabling the target GameObject. Will report unready while Armed and not tripped. |
VTIRunMethod | Utilizes SendCustomEvent() to trigger a named method on the target UdonBehaviour when Fired. When User Messaging is enabled, this Driver will attempt to set the string variables UserName and Message on the target UdonBehaviour.
|
Custom Drivers
The VTI World Kit is designed to be easily extensible by both world designers and programmers alike. To this end, custom Drivers are highly recommended and are built to be fairly simple to create. A custom Driver need only implement one method, VTIEventPlay()
. All other functionality can be added around that, or is already handled by the VTIDriverBase base class.
For an in-depth tutorial on creating a custom Driver, see Creating Custom VTI Drivers.