"Dont destroy on load" does not work at forst
using System.Collections; using System.Collections.Generic; using UnityEngine; public class debugPlanePrefabController : MonoBehaviour { // Use this for initialization void Start () { DontDestroyOnLoad...
View Articlehow to disable dontdestroyonload on a specific scene
hey, i'm making a 2d game that contains bonus scenes, so i manage to put my score to go over the scenes and don't destroy, so it would have the same value when the player went back to the main scene....
View ArticleDo something at the end of every scene in a DontDestroyOnLoad object
I'm using Unity 5. I have an object with a bunch of scripts that is DontDestroyOnLoad. Is there a way to detect that the current scene is ending and to have the scripts on this object do something at...
View ArticleCanvas order and DontDestroyOnLoad
Hello! I have a problem with canvas order. I have 3 scenes in game. There are canvases with own UI elements on each scene plus canvas with common UI elements which put into DontDestroyOnLoad and jorney...
View ArticleDontDestroyOnLoad for a specific scene
I have a scene called 'game'. And a gameobject. Every time the player selects the restart button, the game scene loads again. I don't want the gameobject to destroy when the game scene is loaded fresh....
View ArticleDontDestroyOnLoad Error with Firebase Analytics
Hi. I am trying to export a build to Android, but I get the following error: Error building Player: InvalidOperationException: The following game object is invoking the DontDestroyOnLoad method:...
View ArticleObjects remain under DontDestroyOnLoad despite being removed from the parent
I'm trying to upgrade a project from Unity 4.6 to 5.4 and I'm having an issue with objects not being removed when loading a new scene. I have a root game object which contains the player, camera, game...
View ArticleQuestion Regarding Don'tDestroyOnLoad Object
Hi, I want to ask one thing, I have some objects that attached with the script of Don'tDestroyOnLoad scripts so that the objects will brought to other scene... But I want a certain scene to not have...
View ArticleGameObject::scene and DontDestroyOnLoad()
Hi, If I assign a `GameObject` to the `DontDestroyOnLoad()` method and then call `print(gameObject.scene.name)` it prints out *"DontDestroyOnLoad"* instead of the scene name. Is there a way to get the...
View ArticleHow do you transfer UI Text from one scene to another?
The scoring of my game is based on how far the player travels on the x-axis. I use this code to calculate it: public Transform player; public Text scoreText; void Update() { scoreText.text =...
View ArticleHow to get rid of the duplicates created by DontDestroyOnLoad?
I have a UI Text that gives a score based off of how far the player has traveled using this code: public Transform player; public Text scoreText; void Update() { scoreText.text =...
View Articlelines after WaitForSeconds not executing if started the IEnumerator multiple...
I have the below IEnumerator IEnumerator RemoveLine (string line) { Debug.Log("------------"); yield return new WaitForSeconds (1); Debug.Log("********"); drawLine.RemoveLine (line); } Now I have a...
View ArticleQuality settings reset after scene loads
Hello! I have a settings menu with an option of changing graphics. When a player dies, the scene reloads. My problem is if the player switches graphics in the settings then dies, the graphics default...
View ArticleInstantiate a prefab in every scene
Guys, I am looking for a way to instantiate a prefab in every scene without neither putting gameobjects of it in editor nor another gameobject calling the instantiate. Any idea? The moral: I have a...
View ArticleDontDestroyOnLoad not working in built project but work in editor
DontDestroyOnLoad not working in built project but work in editor.How can I solve it?
View ArticleI am wondering how to save a int in the background
Hi, I have been trying to make an incremental game. I just started making it, but cant figure out how to save my score in the background. I have tried useing DontDestroyOnLoad(gameObject); , but this...
View ArticleCan I create a scene DontDestroyOnLoad in editing mode??
I want some game object always exist in the game. Can I create a scene and the things which are in it don't be destroyed when I go to another scene. I have an idea but I wanna know if you guys have...
View Articledontdestroyonload scene being created on play? what is this and how do I get...
So I'm new to unity, so I'm not sure what is going on or the correct terminology but bear with me (please). I recently started a new game, everything was going fine, then all of a sudden I notice this...
View ArticleDontDestroyOnLoad problem
Hi I'm trying to have a song start in Scene 1 and then continue through to Scene 2. But if Scene 3 happens, I want the audio to stop. I have Scene 1 to Scene 2 worked out. But for some reason I can't...
View ArticleOn Click Missing Audio Object when Scene changes
Not sure if this is a common problem, but it has been frustrating me for hours. I have a Main Menu. Two Buttons. Play and Exit I assign an on Click Event to the play an audio when clicked. ![alt...
View Article