playMaker

Author Topic: Parse updating data [SOLVED]  (Read 1648 times)

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • View Profile
    • Rage Quit Games - Coming Soon
Parse updating data [SOLVED]
« on: May 19, 2014, 02:26:44 PM »
Ok so i'm trying to update string data in parse using the setup in the attached picture, from what i can see these should be the correct actions to update data but when i run the game i get this error

Code: [Select]
Parse Object null
UnityEngine.Debug:Log(Object)
PlayMakerParseProxy:SetParsePropertyFromFsmVar(ParseObject, String, Fsm, FsmVar) (at Assets/PlayMaker Parse/Scripts/PlayMakerParseProxy.cs:193)
HutongGames.PlayMaker.Actions.ParseObjectSetProperty:OnEnter() (at Assets/PlayMaker Parse/Actions/Object/ParseObjectSetProperty.cs:53)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:Start()

What am i doing wrong?
« Last Edit: May 21, 2014, 12:02:11 PM by MrMitch »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15330
  • Official Playmaker Support
    • View Profile
Re: Parse updating data
« Reply #1 on: May 20, 2014, 10:44:50 AM »
Hi,

 Where did you get this object id? from Parse website dashboard? you'll need to first fetch it so that it's available locally and then you can update its property and save it again.

bye,

 Jean

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • View Profile
    • Rage Quit Games - Coming Soon
Re: Parse updating data
« Reply #2 on: May 20, 2014, 11:07:44 AM »
The objectID was taken from the parse website from a Class i created.

So from what you're saying i should use Fetch Async before the actions in the picture?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15330
  • Official Playmaker Support
    • View Profile
Re: Parse updating data
« Reply #3 on: May 21, 2014, 03:46:13 AM »
Hi,

 yes, or "ParseObjectGetAsync" depending on where you are with this:

https://parse.com/docs/unity_guide#objects-retrieving

the first time, you need "ParseObjectGetAsync", and if you suspect that data was changed during your session, use "ParseObjectFetchAsync"

Bye,

 Jean



MrMitch

  • Full Member
  • ***
  • Posts: 131
    • View Profile
    • Rage Quit Games - Coming Soon
Re: Parse updating data
« Reply #4 on: May 21, 2014, 12:01:56 PM »
Thanks Jean got it working.

Although one thing i noticed is that i had to put the actions on different states for them to work as playmaker moves through states faster than parse can respond.

Thanks again :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15330
  • Official Playmaker Support
    • View Profile
Re: Parse updating data [SOLVED]
« Reply #5 on: May 21, 2014, 12:50:22 PM »
Hi,

 On all async operation, you must wait for the action to send one of its event and never rely on the automatic finish procedure within a state. You should always do it exactly like it is in the example, have a proper set of transitions linked up to the parse action send events.

Since these actions are contacting a server online, it's always undefined, how long it will take, and certainly is not synchronous at all.

Bye,

 Jean