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

Application.LoadLevel object clone spam

Hi, I tried DontDestroyOnLoad and Application.LoadLevel and the object is constantly created in the second level. Why is this? using UnityEngine; using System.Collections; public class BacktrackingTest...

View Article


Don'tDestroyOnLoad() - Nulls out references

Hi Everyone, Pretty new to Unity. I'm trying to create a persistent singleton GameController. It's an empty game object, in the scene when the game starts, and has a single script. The script has a...

View Article


Menu music stops playing after returning from game level

Hello everyone! I have a problem with my game music and I can't figure out what's the problem. I have "MenuMusic" gameobject in main menu scene with DontDestroyOnLoad script attached to it. when I go...

View Article

InvokeRepeating on object with DontDestroyOnLoad

I'm having an issue where I have a method that is invoked using InvokeRepeating, and whenever I change scenes the entire thing locks up. I've found that this is because within that repeating method I'm...

View Article

Unity Singelton - Dont destroy on load

Am not quiet sure what exactly is the issue in my code below. Am not able to save the game object with its component between the scene. I have created the singleton and dont destroy on load. Problem:...

View Article


death count resets after re-loading scene

deahtAds script: public int death; private static readonly Dictionary REVMOB_APP_IDS = new Dictionary () { } }; private RevMob revmob; private RevMobFullscreen fullscreen; // Use this for...

View Article

Facebook posting problem in multiple scene architechture

I want to share game logo and text in facebook profile. For this thing right now I am using following plugin [Mobile Social Plugin][1] [1]: https://www.assetstore.unity3d.com/en/#!/content/15066 At...

View Article

Losing prefab transform values on scene open

Hey guys, i'm instantiating a clone of a first person controller in a scene called home, when i start the game, then i go into a scene called city which serves as a portal to other scenes, so far so...

View Article


Return to a specific scene & position

Hellooo I have a few short scenes that can be loaded from several other scenes. I need to return to the right level when done... & keep the players Position... But the "Player" is only a camera on...

View Article


How to make a persistent player a child in a new Scene?

Hi community, I'm new to Unity and have a problem right now. Also English isn't my native language, so please bare with me. I made my player object a singleton script, so I can keep it througout my...

View Article

How to prevent audio restarting on player respawn

Hi Quite new to programming and have been trying to make a 2D top down shooter to practice. The problem I'm having is that everytime the player dies and then hits the respawn button, the music resets....

View Article

Why some objects are destroyed on loadlevel?

My level loads and some of my objects are making it through from the previous level, but some are being being destroyed. Using on all the objects: void Awake() {...

View Article

Keep gameObjects states between scenes without duplicating

Hello, I'm trying to find the best way to solve the following issue : - I have a level 1 with a red light. - While inside level 1, I set the light to the color "blue". - I load the level 2 - I go back...

View Article


DontDestroyOnLoad reset the gameobject

Hi, I'm having a flappy bird kind of game. I would like to have previous score shown on the screen when I die and start it all over. Somehow I don't manage to do so. However the best scores shows at it...

View Article

Accessing a script from another script in different scene

I've been having a lot of trouble with this. I've attached Script A to Object A in Scene A and I want to access Script A in Script B attached to Object B in Scene B. And yes, I've used...

View Article


Carry level slection menu through all levels

Hi I have looked at some tutorials using dontdestroyonload, but none of them give a real answer to this. I have a menu (dropdown) that loads contains all my levels (buttons) But now I want this menu to...

View Article

Is there any better way to "reload the current level"?

I'm using a single Player object and a single Camera object for multiple levels of a game to be able to change seamlessly from one to another maintaining the settings and some variables (a countdown...

View Article


AudioSource in Update

Hey guys, I have different background music clips that should play even if I restart the game. For that purpose I have created a Script attached on a gameObject that only plays the music. private var...

View Article

Restoring Static Variables after DontDestroyOnLoad

Hello everyone! Since the day I realised I'd have to learn using DontDestroyOnLoad() I knew I'd mess up a lot of things. It seems to be one of the hardest Unity Scripting topics for me =( So I have an...

View Article

DontDestroyOnLoad Not Working At All

I have quite a few objects which I'd like to keep for the next three scenes (about 25 objects total). I made the script below, and attached it to all the objects. Unfortunately, the objects destroy...

View Article
Browsing all 416 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>