playMaker

Author Topic: "Set Property" can set target object only once!  (Read 4195 times)

Davision

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
"Set Property" can set target object only once!
« on: July 21, 2012, 09:51:22 AM »
I do a "get component" with a particle emitter that has been set in a variable, then i do a "set property" on the Emit Bool of that component, it works just fine but when i then replace the object variable with a new particle emitter in the next turn it doesn't work anymore. The "set property" still triggers the first particle emitter even though the variable is clearly replaced with the new particle emitter. I double checked through the variables tab at runtime, really strange bug.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: "Set Property" can set target object only once!
« Reply #1 on: July 21, 2012, 11:28:27 AM »
It may be a caching bug... we often use caching to improve performance. I'll look into it...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: "Set Property" can set target object only once!
« Reply #2 on: July 23, 2012, 12:50:57 PM »
Any chance you could send me a small repro scene?

u0204909

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: "Set Property" can set target object only once!
« Reply #3 on: August 01, 2012, 01:36:14 AM »
I have the exact same problem as he does, just in a different setting. Basically I have scripts that have no functionality but consists of public variables that I want to access. Even though my debug logs clearly show a change in the component variables (I used a customised Debug Object action), the get and set property actions constantly use the first component they accessed instead of the current ones.

Even my get property actions act the same way by accessing only the property of the first variable.

I replicated a much simpler scene to test and it worked though, so it might really be a caching problem like you said. Let us know if you can find a solution?
« Last Edit: August 01, 2012, 01:41:30 AM by u0204909 »

u0204909

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: "Set Property" can set target object only once!
« Reply #4 on: August 02, 2012, 12:39:54 AM »
Hi Alex,

Sorry to trouble you but could you have a look at this problem? I am kind of stuck in my project with this issue and even with a debug log that shows my variables changing exactly the way they are suppose to, I constantly access/set the properties of only the first assigned objects. This doesnt happen throughout the project but in a 2 state loop that basically changes object, access a property, change value with temp variables, set property, and then loop.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: "Set Property" can set target object only once!
« Reply #5 on: August 02, 2012, 10:54:09 AM »
Any chance you could send me the "2 state loop" setup?

u0204909

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: "Set Property" can set target object only once!
« Reply #6 on: August 03, 2012, 02:35:10 AM »
Hi Alex, here is the scene I reproduced. There are 3 cubes (Player1, Player2, Player3) and a GameManager.

The GameManager has 2 FSM, FSM_Works and FSM_DoesNotWork. Run each separately for 2 different results.

Basically both FSMs are trying to do the same thing. FSM is not a loop but hard codes each player_in_turn. FSM_DoesNotWork finds the Player & loops until we iterate all 3 Players. Maybe the Find GameObject action is the one with the caching bug.

Now inside each cube Player there is a simple properties script with some variables. I just picked one which is current_army_value. What both FSMs try to do is get the component script, access the property (int) and then add it to itself, before setting the property with the new doubled value. Then we move on to the next player.

I have initialised the values of current_army_value for Player1 to be 1, Player2 to be 2, Player3 to be 3. Therefore, the current_army_value after the FSM finishes should be 2, 4, 6 respectively. FSM_Works produces this result but for FSM_DoesNotWork, it gives, 8, 2, 3. This is due to the fact that it accesses Player1's 1, doubles it to 2. Then it accesses it a 2nd time, doubles it to 4, and then a 3rd time and doubles it to 8. Both Get and Set Property constantly go for Player1. However, like we mentioned before, the Debug GameObject and Debug Object actions show that player_in_turn and the player_properties variables point to the Player1, then Player2, then Player3 and not just Player1.

Hopefully you can get back to us soon.. I really need this to work properly :)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: "Set Property" can set target object only once!
« Reply #7 on: August 04, 2012, 01:02:56 PM »
Thanks for the sample - looking at it now...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: "Set Property" can set target object only once!
« Reply #8 on: August 04, 2012, 01:24:09 PM »
Can you zip and email me the whole project: alex@hutonggames.com

There are some missing actions making it hard to debug...

Thanks!

u0204909

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: "Set Property" can set target object only once!
« Reply #9 on: August 05, 2012, 03:32:09 AM »
Hi Alex, I have sent you the test project. :)

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: "Set Property" can set target object only once!
« Reply #10 on: August 09, 2012, 12:38:56 PM »
Alex, I think I may also have stumbled into this bug. I've attached a screenshot.

Workflow (menu slot 1-35):
1. create menu slot 1.
2. populate menu slot with terrain icon 6. icon 6 added to slot 1.
3. create menu slot 2.
4. populate menu slot with terrain icon 6. icon 6 added to slot 1 instead of slot 2.

I've tried to de-reference the property & set it to null before I create a new menu slot, but this doesn't seem to work. In the screenshot, the icon appears to be referencing slot 2 although it it's still pointing to slot 1.

Does anyone have a workaround for the moment? I'm not sure how else to dynamically generate menus w/o this.
« Last Edit: August 13, 2012, 08:45:51 AM by amaranth »

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: "Set Property" can set target object only once!
« Reply #11 on: August 11, 2012, 09:22:48 PM »
added a few images. i hope they help hunt down the problem!

Andrew_Raphael_Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Re: "Set Property" can set target object only once!
« Reply #12 on: August 12, 2012, 03:00:00 PM »
Hi,
Literally hour ago I was fighting with the same problem. I managed to find a working get around: put Set Property in prefab and spawn/kill it after every one use.

A.

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: "Set Property" can set target object only once!
« Reply #13 on: August 13, 2012, 11:27:54 AM »
I wish I could do that, but it will kill performance on mobile. :(

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: "Set Property" can set target object only once!
« Reply #14 on: September 26, 2012, 04:35:29 PM »
Just following up on some bugs, and wanted to confirm that the beta has fixed these issues...?