SycnTransform.cs 591 B

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SycnTransform : MonoBehaviour
  5. {
  6. public Transform obj;
  7. private Vector3 oldScale;
  8. private void Start()
  9. {
  10. oldScale = obj.localScale;
  11. }
  12. private void Update()
  13. {
  14. if(obj.eulerAngles!= transform.eulerAngles)
  15. {
  16. transform.eulerAngles = obj.eulerAngles;
  17. }
  18. if(oldScale!=obj.localScale)
  19. {
  20. transform.localScale += (obj.localScale - oldScale);
  21. oldScale = obj.localScale;
  22. }
  23. }
  24. }