Quantcast
Channel: Questions in topic: "dontdestroyonload"
Browsing all 416 articles
Browse latest View live
↧

GUI Elements Carry Over To Next Scene

I couldn't really think of a good way to title this problem as it's an interesting one.... maybe someone has a simple solution for something like this. OK here goes. I have a music player in once scene...

View Article


How to check scene number and use it in an If statement?

I have an audio that is set to DontDestroyOnLoad() but I want it to destroy on certain scenes, is it possible to check that and make the audio only DontDestroyOnLoad() if it is a certain scene? Here is...

View Article


DontDestroyOnLoad but script being excuted multiple times

Lets say I have a scene called **MainMenuScene** in which I have a `GameObject`, say, **Datasource_GO**. On this I've assigned a script, say, **Datasource_CS.cs** whose contents can be simply: void...

View Article

Variable in a DontDestroyOnLoad class resetting.

Hello, I haven't been able to find a specific answer for this. I have a class with DontDestroyOnLoad, and when I "restart" the level, a variable in that class resets. public class ScoreController :...

View Article

DontDestroyOnLoad for options UI

So, I am using 4.6 unity and I have an options UI. I know how to pass the options object over to different scenes but my question is, how would I get the 4.6 UI button to open up the options UI when I...

View Article


DontDestroyOnLoad for hidden objects in hierarchy

Just wondering if it is possible to move a hidden object over to another scene? currently it isnt working for me.

View Article

Singleton and DonstDestroyonLoad Problem

I have a Game manager setup which has bunch of tasks like score, changingscene, and GameManager Script using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { static...

View Article

Unity Serializer and DontDestroyOnLoad

So I've been using whydoidoit's Unity Serializer tool. It's a pretty great tool, but I've run into an issue with a script utilising DontDestroyOnLoad. What happens is that the script gets created,...

View Article


Audio source to be played across all scenes without being destroyed?!?

Hello. I was wondering what is wrong with my script. I have attached it to the camera and made an audio source there: var song : AudioSource; function Awake () { if (!audio.isPlaying){ audio.Play(); }...

View Article


How to make sure same gameObjects don't spawn after level reload?

So, basically I have this set up where the Main Camera has music playing, and after each level load, instead of deleting the Camera and Player, you move them through each level with...

View Article

How does "DontDestroyOnLoad" work?

I want to use it in a gameObject (this gameObject contains a AudioSource Component).I want to keep this music between scenes. Can someone explain me how to use it correctly or a example in javascript?...

View Article

'DontDestroyOnLoad' is destroying other gameobjects

HI :) I have a game manager (empty gameobject) which i want to go from level to level as my player progresses. On the game manager, is a score keeping script (in java script), within the 'Awake'...

View Article

Objects of global singleton aren't accessible

I am trying to create some kind of global class storing player data which could be accessible in the whole project. I created simple singleton using this code: void Awake () { if(Instance == null) {...

View Article


Error UCE0001 And BCE0043 in my code, please help me!

#pragma strict { DontDestroyOnLoad (InvisableWall) : void ; } I've been trying for nearly hours to find what I've done wrong here. I think I need some help with this.

View Article

is it OK to use DestroyImmediate in game?

Hi! Right now i'm using DestroyImmediate to destroy duplicates of a game controller (which is a singleton) that has been set to DontDestroyOnLoad(). The reason why i need DestroyImmediate is that...

View Article


Dont Destroy On Load - Exception

what i want to do is a bit hard to explain so i will try to be the maximum comprensible as i can. i have 2 scenes. and i have my menu manager that doesnt destroy on load with the command line:...

View Article

How to access a game object that wasn't destroyed on load?

I have a game object: GameManager, that I want to access from all classes. I've set it in Start() to not be destroyed on load (here is my start function for gamemanager): public void Start(){...

View Article


Spawn carachters on locations and destroy the manager after level load

How do I spawn my carachters to the coordinates 473 44 1213 Depending on the class it will spawn another carachter and later on destroy the manager object It's hard to explain Sorry for noobish...

View Article

Problem with audio source playing on awake

I have my audio source set up on an empty gameObject with this code in the Update function: if (Application.loadedLevelName == "mainMenu") { Destroy(this.gameObject); } else...

View Article

DontDestroyOnLoad duplicate solve test failed.

Hello everyone I have 2 script and im trying that the dontdestroyonload doesnt duplicate the objects when i come back to the first scene i tried to count the tag of the object and if its zero the it...

View Article
Browsing all 416 articles
Browse latest View live