Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: MrMitch on May 19, 2014, 05:26:44 PM

Title: Parse updating data [SOLVED]
Post by: MrMitch on May 19, 2014, 05: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?
Title: Re: Parse updating data
Post by: jeanfabre on May 20, 2014, 01:44:50 PM
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
Title: Re: Parse updating data
Post by: MrMitch on May 20, 2014, 02:07:44 PM
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?
Title: Re: Parse updating data
Post by: jeanfabre on May 21, 2014, 06: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


Title: Re: Parse updating data
Post by: MrMitch on May 21, 2014, 03: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 :)
Title: Re: Parse updating data [SOLVED]
Post by: jeanfabre on May 21, 2014, 03: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