playMaker

Author Topic: global Arrays not keeping data between sences[SOLVED]  (Read 4366 times)

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
global Arrays not keeping data between sences[SOLVED]
« on: May 11, 2016, 02:03:38 AM »
I have a problem that my global arrays are not keeping there data between scenes. This is a problem as I let players get a reward from a array gives them a random object and saves to the players array listing what they have. When I go back to the other scenes the array says null,null instead of items.
« Last Edit: May 12, 2016, 02:18:27 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: global Arrays not keeping data between sences
« Reply #1 on: May 11, 2016, 02:44:29 AM »
Hi,

 Are you sure it's not in your logic that you delete the content?

also, when you have such issues, make sure you fill out a bug report ( in Unity Menu "PlayMaker/Tools/"submit Bug Report", then we'll know your Unity version, PlayMaker version and we can track all this properly.

Bye,

 Jean

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
Re: global Arrays not keeping data between sences
« Reply #2 on: May 11, 2016, 04:00:52 AM »
I am not sure it might be my login so in scene one. First i gather all my items into my first array



Then I let player pull a random from the array and add it to there owned array.

Then I load other sense

And when I go to pull from array to spawn there items.

« Last Edit: May 11, 2016, 04:05:21 AM by Captaincrud »

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
Re: global Arrays not keeping data between sences
« Reply #3 on: May 11, 2016, 04:35:39 PM »
Okay my problem was caused by the game objects in my array deleted between scene.

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: global Arrays not keeping data between sences
« Reply #4 on: May 11, 2016, 05:21:25 PM »
Hi dude,

Did you try do not destroy action on your gameobjects with the arrays?
That should keep the settings and info on them between scenes.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
Re: global Arrays not keeping data between sences
« Reply #5 on: May 11, 2016, 06:54:51 PM »
yeah but not a great solution to as i'm letting players buy different player characters and i don't want clones of every thing the buy in ever sense.

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: global Arrays not keeping data between sences
« Reply #6 on: May 11, 2016, 07:17:05 PM »
Are you able to use player prefs.
You could store their selection and then load it into the array when they are in the scene.

There is also the option of using local or online databases, even an xml file might be an option.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
Re: global Arrays not keeping data between sences
« Reply #7 on: May 11, 2016, 09:24:45 PM »
I can load a list from array to a player prefab? if so how do i do this magic.

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: global Arrays not keeping data between sences
« Reply #8 on: May 12, 2016, 12:31:26 AM »
Hey dude

I made a video for you which you can find here:

http://jonathanoduffy.com/playmaker-forum-q-global-arrays-not-keeping-data-scenes/

It does look like its a bug though. Have you submitted a bug report to Jean?

You can see the bug from this starting point (this shows the array being filled and then in the next scene, which is 15 seconds later, showing the actual array bug):
https://youtu.be/YygfgsHSTIw?t=190
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: global Arrays not keeping data between sences
« Reply #9 on: May 12, 2016, 12:31:35 AM »
Actually.

I was fixing this when I was submitting a bug report. Turns out its not a bug but a logic problem.

What happens is that you are referencing local gameobjects from the hierarchy rather than objects from the project window as a pure prefab and not an instance of a prefab - reason being is that prefab instance is not available in your new scene. I will make a quick video to show you what I mean.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: global Arrays not keeping data between sences
« Reply #10 on: May 12, 2016, 01:00:04 AM »
Hey dude,

I added the solution to the end of the post for you:

http://jonathanoduffy.com/playmaker-forum-q-global-arrays-not-keeping-data-scenes/

Hope it helps.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith