Пример #1
0
        public static void ShowWindow(MethodParametersContainer container, int objectID, string sceneGuid, string name, ParameterInfo[] parameterInfo, UnityEngine.Object target)
        {
            var window = GetWindow <MakeParametersWindow>();

            window._container       = container;
            window._objectID        = objectID;
            window._sceneGuid       = sceneGuid;
            window._methodName      = name;
            window._parameterInfos  = parameterInfo;
            window._parameterValues = new object[parameterInfo.Length];
            window._fieldValues     = new FieldInfo[parameterInfo.Length];
            window._target          = target;
        }
Пример #2
0
        protected virtual void OnEnable()
        {
            target.GetSceneGuidAndObjectID(out _sceneGuid, out _objectID);
            _buttonMethods = new List <MethodInfo>();

            _buttonMethods.AddRange(target.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).
                                    Where(m => m.IsDefined(typeof(EditorButtonAttribute))));

            var containerGuids = AssetDatabase.FindAssets("t:MethodParametersContainer");

            if (containerGuids.Length == 1)
            {
                _container = AssetDatabase.LoadAssetAtPath <MethodParametersContainer>(AssetDatabase.GUIDToAssetPath(containerGuids[0]));
            }

            if (!_container)
            {
                Debug.LogError("Create an instance of the MethodParametersContainer");
            }
        }