public override void OnAncestryChanged() { base.OnAncestryChanged(); this.Camera = null; Component iter = this.Parent; while (iter != null) { if (iter is Camera) { this.Camera = iter as Camera; break; } iter = iter.Parent; } }
public override void OnAncestryChanged() { base.OnAncestryChanged(); this.Camera = this.GetAncestor<GameState>().GetComponentByType<Camera>(); }