protected void CreateControl(Action <Controls, Control> attachEventHandlers) => SharedControls.AccessWithRetry(c => { ControlMonoBehavior = ControlGameObject.AddComponent <Control>(); attachEventHandlers(c, ControlMonoBehavior); var action = typeof(Controls).GetProperty(ControlMonoBehavior.Name).GetValue(c); action.GetType().GetMethod(SharedControls.SetCallbacksMethodName).Invoke(action, new[] { ControlMonoBehavior }); ControlMonoBehavior.enabled = false; });
public void DisableControl() => SharedControls.AccessWithRetry(c => { var action = typeof(Controls).GetProperty(ControlMonoBehavior.Name).GetValue(c); action.GetType().GetMethod(SharedControls.DisableMethodName).Invoke(action, null); ControlGameObject.SetActive(false); });