Custom Variable Type

NodeCanvas Forums Support Custom Variable Type

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12716
    krazor
    Participant

    Hello, i have been trying to figure out how to add custom variable types to node canvas but with no luck i havent been able to find out how to do it correctly, checked the docs says to write a script and drag and drop it into Prefered Types, however this info is not very useful since there is no documentation on what to put in there exactly. so since i was after a list of GameObject, float. i did just that and it did not work of course.

    img1 is the result of what is happening, img 2 is what should show up when i add a new list to the blackboard. any help with this issue would be great.

    Attachments:
    You must be logged in to view attached files.
    #12721
    Gavalakis
    Keymaster

    Hello,

    To add a new type into the available types that NodeCanvas recognize, all you have to do, is to open up the Preferred Types Editor window (“Tools/ParadoxNotion/NodeCanvas/Preferred Types Editor”), click the “Add Type” button in that window, then finally search for the type you want (in this case GameObjectFloat) in the popup that will open, and click it.

    For example:
    PreferredTypes

    Then once your “GameObjectFloat” type is added, you will be able to add a variable of it in a Blackboard by the “Add Variable” button as normal. If you want to add a variable of type List(GameObjectFloat), then in that “Add Variable” menu, you will find that under “Collections/List(T)/List(GameObjectFloat)”.

    Please let me know if that works for you, or if you require more information.

    Thanks!

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

    Attachments:
    You must be logged in to view attached files.
    #12725
    krazor
    Participant

    Hello, thank you for your reply, however i have done this but i am unsure exactly what to put (in your case) ExampleScript

    i do want what i have above with a GameObject / Float to be placed in a list, however this is not working correctly in the blackboard.

    #12726
    krazor
    Participant

    ok finally fixed it after scratching my head for the past few days, wish they mentioned this in the documentation…

    need to remove : MonoBehaviour from your generated class within unity…

    Attachments:
    You must be logged in to view attached files.
    #12729
    Gavalakis
    Keymaster

    Hello,

    Indeed, you only want to derive from the MonoBehaviour Unity type, only if you want to be able to attach the script as a component on a gameobject, otherwise you don’t really need to derive from MonoBehaviour, if for example you are creating pure data classes like in your example 🙂

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

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