TempTest.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. public class TempTest : MonoBehaviour
  4. {
  5. public List<GameObject> list1;
  6. public List<GameObject> list2;
  7. public RectTransform content1;
  8. public RectTransform content2;
  9. void Update()
  10. {
  11. if(SelectView.IsViewOne)
  12. {
  13. for (int i = 0; i < list1.Count; i++)
  14. {
  15. list2[i].transform.localRotation = list1[i].transform.localRotation;
  16. list2[i].transform.localScale = list1[i].transform.localScale;
  17. content2.anchoredPosition = content1.anchoredPosition;
  18. }
  19. }
  20. else
  21. {
  22. for (int i = 0; i < list2.Count; i++)
  23. {
  24. list1[i].transform.localRotation = list2[i].transform.localRotation;
  25. list1[i].transform.localScale = list2[i].transform.localScale;
  26. content1.anchoredPosition = content2.anchoredPosition;
  27. }
  28. }
  29. }
  30. }
  31. public static class SelectView
  32. {
  33. public static bool IsViewOne;
  34. }