using dontDestrpyOnLoad my player multiplies each time i go between my levels C#
so I have two levels where my player goes, gets points returns home then goes out again (in a repetitive cycle) i have the player coming across and transferring values correctly, but if i return to a...
View ArticleDon't lose variable data when reloading a level - c#
Hi, In my game when I used Respawn() I want it to obviously respawn the player, however I want it to save the amount of lives and score the player has when the level is reloaded. When the player does...
View ArticleBizarre Co-routine errors after re-loading scenes
I say 'Bizarre' because until now I've been able to debug my issues relatively competently. The scenario- When i play my scene normally from the inspector i have no issues at all. All co-routines...
View ArticleDontDestroyOnLoad duplicates GameObjects
Hello. I have a strange problem with **DontDestroyOnLoad**. I have some kind of map as a starting scene. From there there user can click on certain map-objects and a new level is loaded with...
View ArticleTrouble finding GameObject in a script that is on an Empty brought over from...
So I have an empty that is holding scripts. This is initiated on the first level (menu) I then use DontDestroyOnLoad to bring it through to the next level as it has some script functions that need to...
View ArticleLoadLevel while FB.Init is in progress
I have a bootstrap scene containing a single **GameObject** which holds the initialization script, just after all variables are initialized I'm calling **Application.LoadLevel** to load the start...
View ArticleAccessing variables on a script on a DontDestroyOnLoad GameObject
Hi all, So I have a GameObject on my first scene that I keep for all of my other scenes using DontDestroyOnLoad. That GameObject has a script on it with a variable that I need to read/write. Every time...
View ArticleDont Destory OnLoad for music background did not play after change Audio Clip
using UnityEngine; using System.Collections; public class SoundManager : MonoBehaviour { public static SoundManager control; AudioSource audioSource; public AudioClip[] audio; public bool isPlaying;...
View ArticleMaking my variable global.
I was trying to change the sprite image of my character from another scene. I made two scripts 1. Sprite_Img.js 2. changeTheSprite.js I have attached Sprite_Img.js to my character object and...
View ArticleDontDestroyOnLoad problem
Hi! I have a problem in using of DontDestroyOnLoad method. I have empty gameObject (SciptObject) with SomeScript in it. Script has public variable "Button", this variable is filled in Unity editor...
View ArticleCopying or duplicating a gameObject from one scene to another
I wanted to copy an object "A" from Scene 1 to Scene 2 such that if a make any changes in the object properties(Eg. SpriteRenderer) in any of the scenes, it effects the other copy from the other scene...
View ArticleSingleton GameManager with DontDestroyOnLoad acting weird
Hi, I've setup a Script called GameManager which has a static instance variable with DontDestroyOnLoad. It is not part of the hierarchy before game launch and is not instantiated, just created....
View Article[2D] problem with character persistence and respawn (dontdestroyonload...
Hello everyone, I am a total beginner with Unity 3D so bear with me :) I am trying to develop a small 2D platformer game. My problem is with my character's respawn. I have a killzone that reloads the...
View ArticleWhy do I loose my Animator?
When I return to may main scene the animation is missing, when I go back to the Scene where the animation originated it is also missing. The Script has the Don't destroy code on it. public class...
View ArticleDontDestroyOnLoad: Many instances of one object
In my game I have many levels: main level (*street*) and other levels (*houses*). Player can come to the houses from the street and when he came back to the street, I want to place him near that house,...
View ArticleDontDestroyOnLoad issue with player.GetComponentInChildren().material.color
Hey Everyone, I have an issue. I have a gameobject (Sphere), which is meant to start off as black (rgb == 000) and through different levels progress towards white (rgb == 1,1,1). I am trying to save...
View ArticleGame Object Looses Children When Return to Scene
I have a game object with the Do Not Destroy on load but when I return to my main scene it looses some of it's children like the UI Slider, how do I fix that? ![Inspector Screen Capture showing...
View ArticleScriptableObject vs DontDestroyOnLoad
I updated to Unity 5.3 and since that I'm receiving the following warning for all the ScriptableObject.DontDestroyOnLoad(instance) calls where the instance parameter is a ScriptableObject created...
View ArticleWorking between different scenes!
I have a gameobject on Main Menu that contains a muted Audio Source. When I hit the Level 1 button, the Audio Source is unmuted and the music starts playing. Also, for this to happen the gameobject has...
View ArticleIf Parent gameobject has DontDestroyOnLoad does it apply to its children?
If I have an empty gameobject and its marked as DontDestoryOnLoad. Now if I add child gameobjects to this empty parent dynamically in code as I instantiate the children, then are the children also...
View Article