The VTITarget component is one of the core scripts for the VTI World Kit. It is used to identify a GameObject as something that can be interacted with by Twitch viewers when running VRChat Twitch Integration (For Worlds!).
Event Firing
When the VTI Event Handler receives an Event from the VTI Companion App, it will enqueue it under the ID of the triggered Target. Once that Event is at the top of the Queue, the Event Handler will attempt to dispatch the Event data to the Target and then call VTIFire()
.
Once Fired, the VTITarget will forward the Event data to each Driver component within the same GameObject as the VTITarget component, and then call VTIEventPlay()
on each Driver.
Readiness Validation
Before firing, the VTI Event Handler will call VTICheckCanFire()
against the queued VTITarget. This will first check the current time against the Cooldown property, and then will loop through all attached Driver component and call VTICheckReady()
on each. If any Driver returns false
, or the Cooldown has not yet elapsed, the Event is skipped and the process repeats for the next in line.
Properties
Property | Usage |
---|---|
ID | The Unique Identifier for this Target. Used internally to dispatch Events. Must not match any other VTITargets in the scene or a warning will be thrown. |
Display Name | The User-Friendly name for this Target. Used in the VTI Companion App's Target editor and when generating Channel Point Rewards. Does not need to be unique. |
Description | A short sentence describing the usage of this Target. Used in the VTI Companion App's Target editor and when generating Channel Point Rewards. |
Cooldown | The number of seconds to wait before this Target can be fired again. Set this to at least as long as the events run by any attached VTI Drivers unless they are capable of being interrupted or overlapped. |
Allow Message Input | Enable this when any attached VTI Drivers expect User Messaging in order to function. |
Allow Event Type Rebinding | If any attached VTI Drivers are specifically tailored to one specific event, disable this. For example: a Driver that expects a chat command with a specific argument will likely not work when set to SUBCRIBE_GIFT. |
Default Event Type | What Twitch Event this Target should be fired on. This presents as a dropdown for all EventSub Subscription Types currently supported by VTI. |
Default Twitch Binding Settings | This section is dynamically displayed based on which Event Type is selected. Use this area to tune exactly what parameters are required to fire this Target. |
Methods
Method | Return | Usage |
---|---|---|
VTICheckCanFire() | bool | Check whether or not this Target is off cooldown and all attached Drivers are reporting Ready. |
VTIFire() | void | Trigger this Target. Forwards Event data to all attached Drivers and calls Driver.VTIEventPlay() on each.
|