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

Keeping a variable after reloading a scene

Hello, i have a variable to controll my animation speed and i want to save that even if i reload the scene so i used a gameobject with DontDestroyOnLoad() with the script attached to it but it just...

View Article


Need advice on best way to deal with scene changes in a card game:

I'm building a card game and, so that I don't crowd the screen, I'd like to utilize scene changes that allow the player to view certain subsets of cards (e.g. the discard pile). The way my game is...

View Article


How to stop audio in a scene when DontDestroyOnLoad was already called?

Hello, so in my main menu scene and in my settings scene their is an object which holds the same audiosource (with the same audioclip), and this script called MyUnitySingleton: private static...

View Article

Dontdestroyonload input field

I have a little in-game console and I made it so it does not destroy on load. Problem is, when I change scenes, the input field stops working. I can still input text through the inspector, but not...

View Article

Canvas 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 Article


Dropdown menu: how to make colour change across multiple scenes

Hi everyone, I am making a settings scene in my game where the user can set the background colour. I have a working code by using different coloured panels but it only applies the colour change in that...

View Article

Why does my Player Object's Transform get destroyed when loading a new scene?

Feel like a newbie, 4 games in with Unity and counting... However, I have a Player object, who's transform is tracked and used by a Camera Script. Both the Player GameObject and Camera gameobject in...

View Article

Should I use DontDestroyOnLoad or prefab for player

I am making a 2D Platformer game (my first game). At the end of each level, a "Level Complete" screen appears, where the user can press a button to go to the next level. I use different scenes for each...

View Article


NavMeshAgent (with DoNotDestroyOnLoad) Not Work After LoadScene; Transform...

I'm having a very bizarre problem. I have a NavMeshAgent component on the player character. Navigation works fine when in my two individual scenes, without jumping between them. I added script to the...

View Article


how to call function from object that is DontDestroyOnLoad ?

I tried FindGameObjectWithTag but it says "cant converter void to gameobject" because obviously there is no gameobject with that tag in that scene, its from another scene. and I have no idea how to...

View Article

How do I link a TMpro to a variable in another scene?

I'm basically having trouble telling the game to show the player gold in the UI. I have a TMPro in a scene, and a Manager that stores the gold and is in a DDOL scene. The thing I tried to do and WORKED...

View Article

DontDestroyOnLoad doesnt work ouside editor

In my game, I have a game manager. I need this to persist between loading stages. When I hit the play button from the editor, it works fine. I navigate from the start menu to the character select menu...

View Article

Problems with transforming my DontDestroyOnLoad Player to a startingPoint on...

Hello, I have a problem with my script public class PlayerStartingPoint : MonoBehaviour { private PlayerControllerLandscape playerControllerLandscape; private CameraControllerLandscape...

View Article


How to detect when scene has changed in a DontDestroyOnLoad script?

Good day. I have a script with DontDestroyOnLoad property. I need to run one method when one scene in particular is loaded. Its clear i need to check for the activeScene , but i dont know how to...

View Article

dontdestroyonload breaks findobjectoftype

I have a gamemanager in my game and want coins to persist through levels without having to save and load them all the time. so I have an awake on the gamemanager that looks like this: public static...

View Article


Test scene with information from main scene

I'm building some sort of Mario party / mini game game. In my main scene you select how many players are playing, which characters will play and they will be put in my "GameManager" script which has a...

View Article

Button loses reference to Networkmanager Object.

Hey, i'm currantly doing the Brackey's FPS Multiplayer tutorial. In the episode when he creates the Create Host UI (E.18) He puts the HostGame script on the NetworkManager GameObject. Since the...

View Article


Problem using DontDestroyOnLoad carrying over a player, but not a camera

So, I am trying to make an overhead 2D RPG. The tutorial series I am watching carried over both the Camera and the Player, but I want the camera background to have a different color in this different...

View Article

When die - reset score from the last scene

Hello there, I have this simple score script for 2D. When you are in the Scene number1 (where main canvas is attached to) and you collect collectibles - the score increases and whenever you die - it...

View Article

DontDestroyOnLoad duplicate prevention code is deleting the original player

Still working on a 2D overhead game. So now I realized that the script I am using for DontDestroyOnLoad is deleting the original player that I am using. DontDestroyOnLoad(transform.gameObject); if...

View Article
Browsing all 416 articles
Browse latest View live


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