using System.Collections; using System.Collections.Generic; using UnityEngine; public class LookTrans : MonoBehaviour { public Transform AimTrans; public Transform[] Trans; int i; Quaternion Qua; Vector3 RotV3 = Vector3.zero; // Update is called once per frame void Update() { for (i = 0; i < Trans.Length; i++) { if (Trans[i].gameObject.activeSelf) { Trans[i].LookAt(AimTrans); RotV3.y = Trans[i].rotation.eulerAngles.y; Qua.eulerAngles = RotV3; Trans[i].rotation = Qua; } } } }