using UnityEngine; namespace RR.Common.Behaviour { public class MessagePlaceholder : MonoBehaviour { private Transform _parentTransform; private Quaternion _lastParentRotation; private void Awake() { _parentTransform = transform.parent; if (_parentTransform != null) { _lastParentRotation = _parentTransform.rotation; } } private void Update() { // Компенсируем поворот только если родитель изменил rotation if (_parentTransform != null && _parentTransform.rotation != _lastParentRotation) { _lastParentRotation = _parentTransform.rotation; transform.rotation = Quaternion.identity; } // Используем childCount вместо GetComponentsInChildren — намного быстрее if (transform.childCount == 0) { Destroy(gameObject); } } } }