playMaker
Home
Store
Showcase
Tutorials
Forums
Manual
Wiki
About Us
Playmaker Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Join our
Discord Channel
Home
Help
Search
Login
Register
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
»
[SOLVED] Global Game Object Variable
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [SOLVED] Global Game Object Variable (Read 3612 times)
turritom
Playmaker Newbie
Posts: 25
[SOLVED] Global Game Object Variable
«
on:
January 13, 2015, 04:30:43 AM »
Hi,
i have a problem with a global game variable .. i want to save the sword object what the player takes for the next level to load from the variable.
but if i save the object in the global variable in runtime ..it saves a clone object ..
see the screenshot
https://dl.dropboxusercontent.com/u/514672/playmaker1.jpg
if i load the next level ... the global game object variable is none
see the next screenshot
https://dl.dropboxusercontent.com/u/514672/playmaker2.jpg
so how can i fix this problem
thank you very much for help
«
Last Edit: January 13, 2015, 12:08:37 PM by Lane
»
Logged
Lane
Administrator
Hero Member
Posts: 2511
Mender of the past
Re: Global Game Object Variable
«
Reply #1 on:
January 13, 2015, 07:04:39 AM »
You need to store the reference to the Prefab, not the Scene's GameObject sword. In the same way you Create the sword and target the prefab, you need to store the reference to it and create it on the next level.
Logged
Products by Cleverous
||
Vault Core
: Database
||
Vault Inventory
: Multiplayer Inventory
||
Vault Attributes
: Character Stats
||
That Hurt!
: Dmg Floaties
||
Quinn
: 3D
turritom
Playmaker Newbie
Posts: 25
Re: Global Game Object Variable
«
Reply #2 on:
January 13, 2015, 07:52:27 AM »
it looks like it linked to the cloned object
but i store the prefab in the Set Game Object ..the Set Game Object is linked to the Prefab ..
you can see it in the next screenshot ..i have click on the Set Game Object - and you see the link
https://dl.dropboxusercontent.com/u/514672/playmaker3.JPG
hmmm can you explain me a solution
Logged
Lane
Administrator
Hero Member
Posts: 2511
Mender of the past
Re: Global Game Object Variable
«
Reply #3 on:
January 13, 2015, 08:02:33 AM »
Hmm, a bit hard to follow in German(?). How are you actually maintaining that variable across scenes? Playerprefs or a singleton?
Logged
Products by Cleverous
||
Vault Core
: Database
||
Vault Inventory
: Multiplayer Inventory
||
Vault Attributes
: Character Stats
||
That Hurt!
: Dmg Floaties
||
Quinn
: 3D
turritom
Playmaker Newbie
Posts: 25
Re: Global Game Object Variable
«
Reply #4 on:
January 13, 2015, 08:12:34 AM »
hmmm that the question .. other variables are not change across the scenery i think so i figured that the global variables not changed across scenes .. so i dont save the variable in any way ..
yes its german
and sorry for my english ..
Logged
Lane
Administrator
Hero Member
Posts: 2511
Mender of the past
Re: Global Game Object Variable
«
Reply #5 on:
January 13, 2015, 08:16:47 AM »
You can use a Manager GameObject that maintains the variables you need to pass across the scene, then use Dont Destroy On Load Action to keep it between scene changes.
Logged
Products by Cleverous
||
Vault Core
: Database
||
Vault Inventory
: Multiplayer Inventory
||
Vault Attributes
: Character Stats
||
That Hurt!
: Dmg Floaties
||
Quinn
: 3D
turritom
Playmaker Newbie
Posts: 25
Re: Global Game Object Variable
«
Reply #6 on:
January 13, 2015, 09:29:52 AM »
but how can i link a prefab gameobject at runtime to a global variable ? then i think that is my problem
Logged
Lane
Administrator
Hero Member
Posts: 2511
Mender of the past
Re: Global Game Object Variable
«
Reply #7 on:
January 13, 2015, 09:38:49 AM »
If you have an object that lives from scene to scene, just store those values in that object and retrieve them in the next scene. You could have that same object define the necessary globals when it wakes up, if you wanted to.
Logged
Products by Cleverous
||
Vault Core
: Database
||
Vault Inventory
: Multiplayer Inventory
||
Vault Attributes
: Character Stats
||
That Hurt!
: Dmg Floaties
||
Quinn
: 3D
turritom
Playmaker Newbie
Posts: 25
Re: Global Game Object Variable
«
Reply #8 on:
January 13, 2015, 11:48:49 AM »
yeah, dont destroy on load works fine
thank you very much !
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
»
[SOLVED] Global Game Object Variable