void OnEnable() { CompassPro compass = CompassPro.instance; if (!Application.isPlaying && compass != null && compass.POIisRegistered(this)) { id = 0; } if (id == 0) { id = System.Guid.NewGuid().GetHashCode(); } }
// Use this for initialization void Start() { CompassPro compass = CompassPro.instance; if (compass == null) { return; } if (dontDestroyOnLoad && Application.isPlaying) { if (compass.POIisRegistered(this)) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); } compass.POIRegister(this); }