Giter Site home page Giter Site logo

DefinedValues w. method is null about mybox HOT 4 CLOSED

Exa644 avatar Exa644 commented on July 30, 2024
DefinedValues w. method is null

from mybox.

Comments (4)

Deadcows avatar Deadcows commented on July 30, 2024

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?
image

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.

Exa644 avatar Exa644 commented on July 30, 2024

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
billede
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.

Exa644 avatar Exa644 commented on July 30, 2024

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 billede 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
billede
billede

(As additional information, I'm using several
[ConditionalField(true, nameof(ConsequenceMathReqPredicate))]
in the ConsequencesStruct class already, which are working as intended)

from mybox.

Deadcows avatar Deadcows commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.