Destroy object when a new scene loads
Hi currently I have a timer that has dontDestroyOnLoad Function in order for it to cycle those scenes that needed a timer, my question is how can I destroy my timer when the game loads the main menu...
View ArticleHow to keep the light on/off after changing scenes?
For example, the player is currently at scene_1; he turns the light off; then he goes to scene_2 and does something and goes back to scene_1, and the light in scene_1 should still be off. How can I...
View ArticleCoroutine couldn't be started because the the game object is inactive on a...
Hi all, I appreciate there's lots of similar questions to this, but I'm getting the above error. What sets mine aside from the other questions I've seen is the fact that the coroutine I'm calling is...
View ArticleMoving between levels (Super Mario RPG Style)
Hey guys, I am trying to move between levels (Scenes) just the same way as SMRPG. I have collider triggers and a spawner transform set up on little exit tabs that load the next scene and move my...
View ArticleKeeping variables between scenes with scriptable objects?
I need to keep variables (Either Bools or Ints) from one scene to another(Menu to different levels) and I'm wondering if scriptable objects can be used for that purpose, since they don't have to be...
View ArticleDontDestroyOnLoad Still Destroying Object
I have an empty game object that contains the two objects for my player as its children. I have a script that is on the empty parent that calls DontDestroyOnLoad, however I get the error:...
View ArticleSingleton and DontDestroyOnLoad question
Hi, I'm using a singleton design to keep the player profile persistent between scenes. I'm having a problem when I return to the main menu from a level. Lets call my main menu scene A and a level in...
View ArticleAnimation not showing, but Animator running?
Im making a dress-up thing where after the player is done dressing up the character, the next scene would be the World scene where he can move the player around. While the player moves around, there...
View ArticleI use the DontDestroyOnLoad Function to preserve my score to the next level....
Before using the DontDestroyOnLoad Function, I used PlayerPrefs to save my score and I was able to get a high score when I died. But now my High Score is not working. How do I make my high score work...
View ArticleCannot invoke function from script attached to gameobject via DontDestroyOnLoad
Hi, im fairly new to Unity and coding in general (JS in this case). I have a problem trying to invoke a function from a script that is attached a game object in my scene. This game object was carried...
View ArticleBig problem with a small singleton
In my initial scene (Scene_1) I have a gameObject called ApplicationBase, which I made into a singleton like so: public class ApplicationBase_scr : MonoBehaviour { public static ApplicationBase_scr...
View ArticlePlay again music problem. (Please help) :)
So I am making a mobile game. When player loses and goes to "Game Over" scene Music stops playing(that's not the problem), but In the Game Over scene there are 2 buttons:"Go to menu" and "play again!"....
View ArticleSetting Player positioning on a different loaded scene with Dont Destroy On...
I need to keep my Player's settings intact so I use the DontDestroy command. The problem is when using triggers to move in him scene to scene, the script I use to place him in the correct positioning...
View ArticleWhat is the standard solution for preserving level data?
I've found different answers to how you might preserve data on gameobjects without resetting it when loading a new scene, such as DontDestroyOnLoad, PlayerPrefs, LoadLevelAdditive or even just using...
View ArticleDontDestroyOnLoad duplication despite having code that should stop it
I have an object with DoNotDestroyOnLoad and I have code in place that should stop it from duplicating each time I enter the scene where it was instantiated. The weird thing is that only one other...
View ArticleDontDestroyOnLoad ARCamera 'deletes' ImageTargetBehaviour
I've recently updated my project from Vuforia 5.5 to 6.2 using the migration guide found here: https://library.vuforia.com/articles/Solution/Migrating-Unity-Projects-to-Vuforia-6-2 I am working on...
View Articleaccess a gameobject from another scene at design-time
I'll try to describe my problem as clear as possible. I have a baseclass that references other monobehaviour scripts attached to a gameobject in my scene. If I use dontdestroyonload() I can still...
View Article(JS) Makeing demo version of game (15 minutes of demo)
Hi, Im makeing a game and now I want to make demo version of it. This it what I have: #pragma strict var timeLeft = 10000; function Awake () { DontDestroyOnLoad (transform.gameObject); } function...
View ArticleUnity 5.6.0f2 Don't destroy on load duplicate
Hello! I have a problem. Here is some code samples: public static Inventory instance { get; set; } private void Awake() { if (instance == null) { instance = this; } else { DestroyObject(gameObject); }...
View ArticleDontDestroyOnLoad() object not created first time game run
Alrighty, here I am again. So I've created a dontdestroyonload object to work as something that holds all of the game's information throughout scenes like just about anyone would. My problem is that,...
View Article