VIROO Studio - Subscribe to TeleportEvents

Issue:
I would like to have an event that is registered when some user uses the teleport points, from what I have seen, the TeleportPoint component does not include this type of event.

Additional information:
Viroo version: 2.6
Unity version: 2022.3.9f1 and 2022.3.40f1.

Solution:

There is an interface you can inject that provides an event triggered when a teleport point is used. This interface is called ITeleportService, and its implementation for your case would look like this:


protected void Inject(ITeleportService teleportService)
     {
         teleportService.OnTeleportPointTeleportComplete += TeleportService_OnTeleportPointTeleportComplete;
     }

     private void TeleportService_OnTeleportPointTeleportComplete(object sender, TeleportPointEventArgs args)
     {
         // here your code
         Debug.Log($"Teleport point triggered with id {args.TeleportPoint.Identifier}");
     }

     protected void Awake()
     {
         this.QueueForInject();
     }
 }

Please visit our VirooStudio FAQ&Troubleshooting page for more info: VirtualDesk Support - VIROO Knowledge Base - VIROO STUDIO
Attached Files
TeleportServiceExample.cs
404kb