Reply To: How to access a property from a game object from nodeCanvas?

NodeCanvas Forums General Discussion How to access a property from a game object from nodeCanvas? Reply To: How to access a property from a game object from nodeCanvas?

#11788
Gavalakis
Keymaster

Hello,

First of all, thanks for getting NodeCanvas.

To access a property, field or function of a component you need to use the actions/conditions under the “Script Control” category. In your case where you want to check a property, you would want to use the “Check Property” condition.

Once you have added the Check Property condition task, the first thing you would want to do, is to set the target of the task to be your current iterated variable “currentTable”.
CheckProperty

Finally, you will of course also need to select the boolean property you want to check, by clicking the “Select Property” button.
You will notice though, that the list will not contain the component type that you are after, because NodeCanvas does not yet know of that type.
CheckProperty2

So, to make the popup list contain your type, all you need to do, is to open up “Tools/ParadoxNotion/NodeCanvas/Preferred Types Editor”, and in the window that will open up, search your type in the search field and hit the “+” button to add it in the list. So from now on, your added type will show in all NodeCanvas menus and as such you will be able to access properties, fields and functions of it when using any “Script Control” categorized tasks.

Please let me know if that helps, or if you need further explanation.
Thanks.

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

Attachments:
  1. CheckProperty.png

  2. CheckProperty2.png