TestRotObject.cs 581 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TestRotObject : MonoBehaviour
  5. {
  6. public GameObject p6;
  7. public GameObject obj;
  8. public GameObject menuObj;
  9. private void OnEnable()
  10. {
  11. // obj.transform.eulerAngles = p6.transform.eulerAngles;
  12. menuObj.transform.eulerAngles = obj.transform.eulerAngles;
  13. }
  14. public void RotObject( bool state)
  15. {
  16. obj.transform.Rotate(state? Vector3.down : Vector3.up, 90);
  17. menuObj.transform.Rotate(state ? Vector3.down : Vector3.up, 90);
  18. }
  19. }