SameGamesPos.cs 794 B

1234567891011121314151617181920212223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SameGamesPos : MonoBehaviour
  5. {
  6. // Start is called before the first frame update
  7. public string RegionA_objStr;
  8. private GameObject RegionA_obj;
  9. void Start()
  10. {
  11. if (GameObject.Find("SceneRoot/" + RegionA_objStr) == null)
  12. return;
  13. RegionA_obj = GameObject.Find("SceneRoot/" + RegionA_objStr).gameObject;
  14. }
  15. private void LateUpdate()
  16. {
  17. if (RegionA_obj == null)
  18. return;
  19. this.gameObject.transform.position = RegionA_obj.transform.position;
  20. this.gameObject.transform.eulerAngles = new Vector3(RegionA_obj.transform.eulerAngles.x, RegionA_obj.transform.eulerAngles.y, RegionA_obj.transform.eulerAngles.z);
  21. }
  22. }