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.
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:
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.
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
Author
Posts
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.