0728
This commit is contained in:
22
Assets/02_Scripts/Story/ch3/ResetChildLocalRotation.cs
Normal file
22
Assets/02_Scripts/Story/ch3/ResetChildLocalRotation.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ResetChildLocalRotation : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform target;
|
||||
|
||||
private Quaternion initialLocalRotation;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (target != null)
|
||||
initialLocalRotation = target.localRotation;
|
||||
}
|
||||
|
||||
public void ResetRotation()
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
target.localRotation = initialLocalRotation;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user