Custom Drawer Accessing Source Class

FlowCanvas Forums Support Custom Drawer Accessing Source Class

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3478
    atmuc
    Participant

    I have a string field. I want to show a dropdown on FC inspector. I write an attribute drawer called ListSource. I send “Function Name” (AbilityList) as a string to that drawer. How can a drawer access to source class, call a function on the source class?

    I want to do something like this;

    https://odininspector.com/attributes/value-dropdown-attribute

     

    [ListSource(“AbilityList”)]

    public string AbilityName;

    public List<ComboItem> AbilityList{…..}

     

     

    #3485
    Gavalakis
    Keymaster

    Hello there,

    Within an AttributeDrawer, you can access the source object with the ‘.context’ property. You can then use reflection to call a function by name or in this case get a field (AbilityList) by name. Here is an example of such a drawer:

    Let me know if that works for you.

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.