using Immersal.AR; using UnityEngine; using Blue; /// /// 控制Immersal定位 /// public class ImmersalLocalizerController: AbstractController { [SerializeField] private XRLocalizer XRLocalizer; [SerializeField] private float rateTime = 2f; private float time = 0f; private bool startLocalizer=false; private void Awake() { this.RegisterEvent(e=> { XRLocalizer = GameObject.Find("ImmersalSDK").GetComponent(); // 获取XRLocalizer this.enabled = true; // 开启脚本 startLocalizer = true; // 开始定位 }).UnRegisterWhenGameObjectDestroyed(gameObject); } void Update() { time += Time.deltaTime; if(time > rateTime && startLocalizer && !SetSceneActive.Instance.active) { XRLocalizer.Localize(); time= 0; } } }