UPBGE / UPBGE-logicnodes

A Node-based Logic system for UPBGE 2.8+
Other
53 stars 18 forks source link

Setting another objects property doesn't work from logic tree applied to multiple objects #90

Closed proband15 closed 1 year ago

proband15 commented 1 year ago

I want to change the text of a UI widget from two objects in the scene by using the 'Set Property Node' referencing the object that has the UI logic tree. Both of these objects have the same logic tree applied but different Property values.. However it appears that this only works for the object that was most recently added to the scene. If I remove the object from the scene in game it then works for the other object too.

To specifiy: I have two items ( a blue and a red potion flask) in the scene with a 'name property' (a string property). If the player gets close to one these items i want to change the UI Text by passing the value of the 'name property' of the item over and change the value of the UI-Objects 'display item name property' to that name. It works quite well, however only for the newer item instance in the scene. So if the red potion was later added to the scene, only the 'Red Potion' will be shown on UI, the blue potion does nothing. If I then remove the red potion from the scene in game, the blue potion works too.

I thought that logic trees work per object instance, so I'm not sure if this is a bug or if I'm doing something wrong. Thank you for your help.

proband15 commented 1 year ago

Ok, sry I somehow got this working by restructuring my nodes. Guess I did something wrong.