Comments (4)
Interesting! Your example works as intended on my side 🤔 This test example does not involve any inheritance, right? I could imagine that method from the base class might not be found, but probably it's not the case.
I just added a safecheck to at least not spam the exceptions.
Apparently, there is some problem with finding the method, or with the acquisition of return values. Can you debug with breakpoint on line 100 and see if the GetMethods result is adequate, or is the result returned with invocation is null?
Also, in this particular case as an alternative you can write [DefinedValues("A", "B", "C")] public string StringSelection;
, but I understand that it is just the test case and you need a more versatile solution
from mybox.
The example does not involve any inheritance, no. (As in Public Class XX{})
The hand-crafted DefinedValues("A","B","C") does work - I was specifically looking to run it through a function however, in order to define different list-items depending on another variable
Does have this bit under the type, if that's helpful
Name | Value | Type | |
---|---|---|---|
DeclaringMethod | System.InvalidOperationException: DeclaringMethod can only be used on generic arguments | System.Reflection.MethodBase |
(Method is null, so we never get to the invoke)
from mybox.
The example does not involve any inheritance, no. (As in Public Class XX{})
The hand-crafted DefinedValues("A","B","C") does work - I was specifically looking to run it through a function however, in order to define different list-items depending on another variable
Does have this bit under the type, if that's helpful
Name Value Type
DeclaringMethod System.InvalidOperationException: DeclaringMethod can only be used on generic arguments System.Reflection.MethodBase
For context, the field I'm trying to apply this to exists inside a class called "ConsequencesStruct" (slightly misleading name, but)
This is used as a
public ConsequencesStruct[] ConsequencesToApply;
under another called AnswerStruct, which is used as a
AnswerStruct[] Answers;
under a class called DialogueState, inheriting from StateMachineBehaviour
Which is a component on an animationController
(As additional information, I'm using several
[ConditionalField(true, nameof(ConsequenceMathReqPredicate))]
in the ConsequencesStruct class already, which are working as intended)
from mybox.
Ohhhh I see! I never tested the usage of this attribute within nested serialized types apparently 🙂
It always looked up the method definition in the base serialized type, which is DialogueState in your case.
I fixed it for you. Thank you a lot for the report! Helpful one 🙂
The other inconvenience I noticed, is that method results are collected and cached on Inspector initialization. So, if you toggle some state that should affect returning values through the inspector, you'll have to deselect this node and select it again (thus reinitialize the inspector for DialogueState) to see the changes. If this will be a major inconvenience for you, please let me know, it should be relatively easy to fix.
from mybox.
Related Issues (20)
- Bug: Waiting for user code in MyBox.dll to finish executing HOT 3
- Crash in MySerializedProperty
- Constant errors with conditional field
- Enter Play mode being slower after install the package HOT 5
- Release with .unitypackage HOT 1
- Naming Conflit HOT 1
- Editor takes a long time in "MyEditorEvents.OnWillSaveAssets" HOT 4
- [ButtonMethod] not work in list item HOT 9
- Passing a List or Array to DefinedValues HOT 3
- ConditionalField does not work when RegexString is used on the same fields HOT 1
- Missing def for Attributes/DefinedValuesAttribute.cs HOT 1
- ConditionalFieldAttribute is rather slow HOT 3
- Suggestion: Help boxes
- Using [ConditonalField] causes Editor Button to be drawn twice HOT 2
- ReadOnly HOT 1
- "No GUI Implemented" when using a UIElement Property Drawer with Default Inspector. HOT 5
- MyEditorAudio.cs not found. HOT 1
- [ConditionalField] doesn't work with lists or arrays HOT 1
- Foldout doesn't work properly in child classes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybox.