Access monobehaviour variable from BT

DrewofDonuts

New member
I just can't seem to understand the documentation if it's already providing how to do this, so my apologies in advance.

I would like to be able to manipulate monobehavior variables from the behavior tree.

If someone could please assist, I'd greatly appreciate it!
 
Within the task you can call GetComponent<MyMonoBehaviour>() and then access a reference to that component. This will then allow you to access it like any other component.
 
Within the task you can call GetComponent<MyMonoBehaviour>() and then access a reference to that component. This will then allow you to access it like any other component.
I'm sorry to be a pain, but if you could provide a little information on the broad steps (or even just where to start the process), that would very helpful. I'm not sure if you mean that I should edit the task within the script, or if that can be done within the Behavior Designer GUI.
 
Thank you!

I discovered the use of creating properties and using set/get shared variable tasks. Is there any concerns of using that method as a project grows? Any performant issues?
 
No, those are ok for performance. When a property mapping is used it creates a delegate which is fast, and the get/set variables don't use any reflection.
 
Top