static GameObject InitController(GameObject go, int index) { Controller ctrl = go.GetComponent <Controller>(); if (ctrl == null) { ctrl = go.AddComponent <Controller>(); } ctrl._Initialize(index); controllers[index] = ctrl; return(go); }
static GameObject InitController(Transform tr, int index) { Controller ctrl = tr.GetComponent <Controller>(); if (ctrl == null) { ctrl = tr.gameObject.AddComponent <Controller>(); } ctrl._Initialize(index); controllers[index] = ctrl; return(tr.gameObject); }