public static string GenerateUniqueNodeName(Type type, StateMachine stateMachine) { int cnt = 0; string uniqueName = (type == typeof(State)?"State":"FSM"); while (FsmUtility.NodeExists(stateMachine.Root, uniqueName + " " + cnt.ToString())) { cnt++; } return(uniqueName + " " + cnt.ToString()); }