protected override async void Start() { base.Start(); if (lateRegisterTeleport) { if (TeleportSystem == null) { await new WaitUntil(() => TeleportSystem != null); // We've been destroyed during the await. if (this == null) { return; } // The pointer's input source was lost during the await. if (Controller == null) { Destroy(gameObject); return; } } lateRegisterTeleport = false; TeleportSystem.RegisterHandler <IMixedRealityTeleportHandler>(this); } }
protected override void OnEnable() { base.OnEnable(); if (gravityDistorter == null) { gravityDistorter = GetComponent <DistorterGravity>(); } if (!lateRegisterTeleport) { TeleportSystem?.RegisterHandler <IMixedRealityTeleportHandler>(this); } }