How to access a property from a game object from nodeCanvas?

Forums 💬 NodeCanvas 🗨️ General Discussion How to access a property from a game object from nodeCanvas?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14013
    ehrlichmann
    Participant

      Hi there. I’m new here.

      I’ve recently bought node Canvas for a project I am working on, and have stumbled upon a stone that won’t lemme progress. Here’s the thing:
      I’m scanning a scene with the “findAllWithTag” action, and am storing that information on a list. When I have that list, I wanna go thru it with an “Iterate” node and generate a depurated list that contains ONLY the objects that comply with a boolean flag that’s contained within them (isAvailable). The thing is, that I’ve tried multiple ways and cannot access that property from the objects on the list created previously.

      Can you please guide me on how to achieve that? Any help will be greatly appreciated.

      Best regards.

      Ehrlichmann.

      #14015
      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”.
        [attachment file=”CheckProperty.png”]

        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.
        [attachment file=”CheckProperty2.png”]

        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.

        #14014
        ehrlichmann
        Participant

          Hi there.

          Thanks for your prompt reply.

          It worked. it took a lil tweaking from my side, but it did what I was expecting.

          Thank you very much.

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