private static void SetUpControllerAndStateMachine(int instanceID)
    {
        string assetPath = AssetDatabase.GetAssetPath(instanceID);
        Object obj       = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object));

        if (!obj && Selection.activeObject)
        {
            assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);
            obj       = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object));
        }
        if (obj is StateMachineController <M, S, T> )
        {
            controller = (StateMachineController <M, S, T>)obj;
            EditorPrefs.SetInt("StateMachineMackerLastController", controller.GetInstanceID());
        }
    }