private void Start() { Transform[] componentsInChildren = GetComponentsInChildren <Transform>(includeInactive: true); Dictionary <string, GameObject> dictionary = new Dictionary <string, GameObject>(); for (int i = 0; i < componentsInChildren.Length; i++) { dictionary[componentsInChildren[i].name] = componentsInChildren[i].gameObject; } for (int i = 0; i < Bindings.Length; i++) { string target = Bindings[i].Target; if (!dictionary.TryGetValue(target, out var value)) { value = new GameObject(target); value.transform.SetParent(base.transform, worldPositionStays: false); } StateMachineProxy stateMachineProxy = value.AddComponent <StateMachineProxy>(); stateMachineProxy.TargetStateMachine = Bindings[i].TargetStateMachine; } }
internal void AddStateMachineProxy(string target, StateMachineProxy proxy) { stateMachineProxies.Add(target, proxy); }