public static UtilityWindow OpenWindow <TBehaviour>(params object[] parameters) where TBehaviour : WindowEditor { string name = ObjectNames.NicifyVariableName(typeof(TBehaviour).Name).Replace("Editor", ""); var window = GetWindow <UtilityWindow>(true, name); window.wantsMouseMove = true; TBehaviour behaviour = (TBehaviour)Activator.CreateInstance(typeof(TBehaviour), parameters); window.name = behaviour.Name; window._editor = behaviour; return(window); }
public TBehaviour ChangeBehaviour <TBehaviour>() where TBehaviour : CaseBehaviour <TBehaviour> { TBehaviour newBehaviour = gameObject.AddComponent <TBehaviour>(); newBehaviour.Object = Object; newBehaviour.SetPosition(PositionX, PositionY); newBehaviour.transform.parent = transform; newBehaviour.transform.position = new Vector3(PositionX + 0.5f, PositionY + 0.5f, 0); Destroy(GetComponent(GetType())); RefreshObjectSprite(); return(newBehaviour); }