Once a V_Activatable component is attached to your GameObject and configured correctly, ViRSE will automatically detect player input according to which mode they are in. In the Activatable’s default configuration, interactions are triggered as follows
By default, the on/off state of the Activatable will be synced to all other clients in the instance automatically, as well as the client ID of the last user to interact with the activatable
<aside> ⚠️ In their default configurations, Activatables must have a trigger collider to register interactions
</aside>
Receiving activations
//Link this function to the OnActivated event in the Activatable's inspector
public void OnActivatableActivated(string playerID)
{
Debug.Log($"Player with ID {playerID} activated the Activatable!");
}
Triggering behaviors through code
//Expose reference to GameObject in inspector
[SerializeField] private GameObject gameObjectWithVirseComponent;
//Reference to ViRSE component's interface, in this case, an IActivatable
private IActivatable virseComponent => gameObjectWithVirseComponent.GetComponent<IActivatable>();
//An example of programmatically activating an activatable
private void ActivateActivatable()
{
virseComponent.Activate();
}
<aside> 🤓 IsProgrammatic You may only wish to utilize Activatables only for their automatic syncing functionality, rather than providing something for the user to interact with. When IsProgrammatic is set to true, the Activatable no longer requires anything “physical” in the scene, and it can instead be activated and deactivated through code, where upon the activation state will be synced to other clients in the instance as usual
</aside>