Multiple instances of a game object with the same tree

Rick

New member
I created an in variable named hunger. However, in code it's referred to as a SharedInt. The issue I have now is that when I spawn 2 of the same prefab with this BT on it, that value seems to be shared between the 2 instances. In the variable creation in the BT Editor it just said int. Is there any way to have these variables not shared in the BT?
 
Last edited:
When you call instantiate they are two different instances. Are you sure that they are the same? Have you gotten the instance ID of the variable?

If you are using global variables though those will be the same.
 
Nvm figured it out. It was on my side and Mirror specific. In case you're curious, the hunger is a SyncVar and I have a hook to know when it's been updated from the server and inside the hook I update the UI on the screen. Of course with 2 instances both were doing this and it's the 1 UI for the local player not a player specific UI. Had to make sure I only updated the UI for the local player in the hook. My bad. Thank you. Just needed a little sleep :)
 
Top