// MIT License - Copyright (c) 2025 wallstop // Full license text: https://github.com/wallstop/unity-helpers/blob/main/LICENSE namespace Samples.UnityHelpers.Relational.Basic { using UnityEngine; using WallstopStudios.UnityHelpers.Core.Attributes; /// /// Minimal, container-free example of Relational Component Attributes. /// Attach to a child GameObject with a parent and a sibling to see fields auto-assigned. /// public sealed class RelationalBasicConsumer : MonoBehaviour { [SiblingComponent] private Transform siblingTransform; [ChildComponent] private Collider childCollider; [ParentComponent(OnlyAncestors = true, MaxDepth = 1)] private Transform directParent; private void Awake() { this.AssignRelationalComponents(); } private void Start() { string parentName = directParent != null ? directParent.name : ""; string siblingName = siblingTransform != null ? siblingTransform.name : ""; string childName = childCollider != null ? childCollider.name : ""; Debug.Log( $"Relational assigned → parent={parentName}, sibling={siblingName}, child={childName}", this ); } } }