12345678910111213141516171819202122232425262728293031 |
- using UnityEngine;
- using Blue;
- using UnityEngine.UI;
- public class SpoitNameController : AbstractController
- {
- private Transform target;
- private bool look;
- private GameObject child;
- public Text spoitText;
- private void Start()
- {
- target = GameObject.Find("ARSpaceForAll/mesh_test/SceneRoot/Player").transform;
- child = transform.GetChild(0).gameObject;
- spoitText.text = transform.parent.name;
- this.RegisterEvent<EditorSettingEvent>((e)=>
- {
- if(e.editor)
- child.SetActive(true);
- else
- child.SetActive(false);
- look = e.editor;
- }).UnRegisterWhenGameObjectDestroyed(gameObject);
- }
- void Update()
- {
- if(look)
- transform.LookAt(new Vector3(target.position.x, transform.position.y, target.position.z));
- }
- }
|