playMaker

Author Topic: Set player position [SOLVED]  (Read 9959 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set player position
« Reply #15 on: October 31, 2013, 03:35:45 AM »
Hi,

I think you neeed to use PlayePrefX,

https://hutonggames.fogbugz.com/default.asp?W1118

You can then save vector3 without problems,

bye,

 Jean

Timo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Set player position
« Reply #16 on: October 31, 2013, 12:16:45 PM »
Hey Jean,

So I get a vector 3, but how do I attach the player prefs key to my prefab player object so it is getting and setting the value of that object? It just states get vector 3, which I did then I stored it in a variable, but when the scene reloads that variable is wiped so I can't pull the vector 3 data from it. So how would I attach a key to an object so it's setting and getting information from that object?

I've attached some screen captures of loading the object into the scene, how I thought I need to set a key, and then capturing the position/rotation

redikann,

I'll zip it up and send you another message.

Thanks!
« Last Edit: October 31, 2013, 12:31:59 PM by Timo »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set player position
« Reply #17 on: October 31, 2013, 03:01:10 PM »
Hi,

 there isn't any automatic binding between a playerpref key and what controls it ( your prefab), so you need to create a key yourself.

typically, you will need to do the following:

1: when you instanciate a prefab, you need to give it a unique name or id,
2: when you want to store the player position, you create a key that starts with the prefab name or id + "-position" so you would have "Prefab1-position"
3: then when set get this key from the playerprefs, you can't get mixed up between prefabs.

does that make sense? the playerPrefs is a very raw system, a list of key/value pairs, so you need create your keys very carefully so that they are unique and don't overwrite one another.

bye,

 Jean

Timo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Set player position
« Reply #18 on: November 04, 2013, 10:06:36 AM »
Hi Jean,

Thanks! That process does make sense!

and thank you to Redikann for going over my project files for me to help get a working solution!