58 questions
0
votes
0
answers
35
views
Scene lighting acting strangely when I change scene
I have been encountering this problem when I use SceneManager to change the scene or restart. where the new scene looks darker and the shadows more prominent even though the values are the same.
See ...
1
vote
1
answer
30
views
I cant reload scenes in unity without code stop working
I am trying to make a molti level 2D game in unity, the problem shows up when u load the scene with a level, then u go to the main menu or complete the level and return to the map, and try to restart ...
0
votes
0
answers
78
views
Scene Transition Takes Long Time
I have a shop scene. There is a button that brings player back to menu scene. But transition from shop to menu a takes a bit long and I do not know why. I checked all codes and debugged them. Also ...
0
votes
0
answers
44
views
Unity when touch phase ended in switch case scenario, it will return back to touch phase began when it moved to anoter scene
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class no1 : MonoBehaviour
{
[SerializeField]
private Transform no1bg;
private Vector2 initialPosition;
...
0
votes
2
answers
115
views
I'm trying to load scene by clicking button but when I write using UnityEngine.SceneManagement; it doesn't recognize the SceneManager.LoadScene line
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MenuButton : MonoBehaviour
{
// Start is called before the first ...
1
vote
1
answer
1k
views
Player movement doesn't work after reloading the scene in Unity
Using Unity 2021.3.16f1.
I followed this tutorial from Brackeys to make the pause menu for my flappybird like game, my player movement stops working after I exit the main game to the main menu and ...
0
votes
1
answer
245
views
When loading the main menu scene in Unity, I need the player position to reset even if there's a playerprefs save
I need to reset the player's position in the main menu scene to 0,0,0, whether or not they have saved their playerprefs.
This is the code I'm using in Unity to reset the player's position when they ...
0
votes
1
answer
456
views
Data Persistence between Scenes in Unity creates multiple instances, regardless of conditional destroying of extra Game Objects
I am creating a game where the first scene will have a generated map saved as a 2D array, then the next scene takes care of all the combat. Once that's done, user needs to go back to the first scene ...
0
votes
1
answer
314
views
Why does successive loadings of scenes take a very long time?
I have a simple 2D top-down adventure game.
There's a main level scene with houses.
The player can enter the house and when doing so it deletes the main scene and loads the house scene.
Respectively, ...
0
votes
2
answers
2k
views
Why does activation phase of a scene being loaded in Unity take too much time?
I'm new to Unity3D. I am trying to make my own FPS game in Unity 2020.3. I have to make a lot of maps (scenes). So far I discovered a problem with LoadSceneAsync.
What I know from Unity docs: When ...
0
votes
2
answers
40
views
Error with Fader during Scene Transitions
I successfully used a fader in a practice game I made a few months back. I am now trying to implement a similar approach for my mobile game.
My goal: when a user goes to the play screen, the screen ...
-1
votes
1
answer
549
views
Check if boolean is true from another script/scene [duplicate]
I'm writing a code in unity where the player clicks on a mousetrap, which sets the boolean mousetrap = true and increases its value to 1. That is attached to a gameobject called Trap. When I click on ...
1
vote
1
answer
46
views
Simulating a second, hidden physics scene into the future on a single frame to predict the trajectories of planets?
I want to simulate the trajectories of planets in a seperate scene to find out where they will be in the future. I drew a quick diagram to demonstrate.
Is there a way to simulate 2 scenes separately, ...
1
vote
1
answer
2k
views
Load Scene is not restarting the scene properly
I'm trying to restart my game when the player loses, I play a coroutine which makes the player ignore collisions and falling off the platforms. Then when the player click a button, the same scene is ...
0
votes
1
answer
1k
views
Unity - Scene Additive Not showing in final Build
so I'm having a problem.
I'm developing a game for our final project and I'm using scene load additive to load all the scenes). So the problem is... Everything works right when I test/play the game ...
0
votes
1
answer
65
views
transporting a bool across scene's while changing it
For my game you need to complete a mini-game to unlock abilities. But I atually have no clue how to do it cause the value gets resetted to false whenever I load the main-level.
Code playerMovement:
...
0
votes
1
answer
4k
views
Unity SceneManager loads scene, Start / Awake do not run on load
I have a StartupScript that i want to run every time when a scene (re)loads.
When I load Scene 1 the script runs.
When I load Scene 2 the script runs.
When I go back to Scene 1 the script does not run....
0
votes
1
answer
93
views
Can i change the scene (value?) via public void or something? I do not want to make a new code everytime and change the scene that is going to load
This is the code i am using. It switches to another scene if the goal gets touched by an objekt with the right tag. Now I want to know how i can change the numbers of the scenes via unity without ...
0
votes
2
answers
884
views
Unity 3D Collision on gameobject not working
I've made a code where once you collide on a gameobject, it will go to a different scene, the gameobject is a bed, I've applied a tag named Bed, I've applied a rigidbody, I've applied the code to the ...
1
vote
1
answer
2k
views
UnityException: GetActiveScene is not allowed to be called from a MonoBehaviour constructor
I'm trying to make a save level system and I keep on getting this error.
UnityException: GetActiveScene is not allowed to be called from a MonoBehaviour constructor
I've tried searching this up, but ...
0
votes
1
answer
429
views
How can I share scores via 2 scenes in Unity
I am a New person to Unity. My problem is that I have a Score in my first scene which is the position of z of the player. I want it to save it to the HighScore using PlayerPrefs. I have 2 empty ...
0
votes
1
answer
2k
views
button.OnClick listener triggers twice
My play button in scene changes the current menu scene to the actual level scene.
I added the listener method in the form of a delegate:
playLevel.onClick.AddListener(delegate { LoadLevel();})
Most ...
0
votes
1
answer
33
views
How to keep player skin through restart
I'm trying to keep the player skin, even when reloading the scene, or moving on to a new one. The player object changes every scene.
The player skin is chosen in a pause menu, with three buttons. Each ...
2
votes
1
answer
723
views
Empty Scene is taking time to unload in Unity
I have a normal project with about 30 Scripts and 30 Scenes (approx). When unloading any scene, it takes about 2 seconds.
For testing, I have made 2 empty scenes with 1 button each and want to ...
-1
votes
1
answer
108
views
unity scenemanager only reload active scene
public void startscene(string scnm)
{
Debug.Log("DF");
SceneManager.LoadScene(scnm);
Debug.Log("DF");
}
I used this code to go back to the menu scene and come to the ...
0
votes
1
answer
5k
views
Unity - unable to list all scenes in a project
In my app, I wanted to get a list of certain scenes and their build indices at start up of a particular scene. The probability is that none of the scenes has yet been loaded.
To do this I tried ...
-1
votes
1
answer
698
views
How to use a button in unity to go to different scene in different condition?
In my unity game there are 3 levels and when a player lose any level a same "Game Over" scene appears having a "play again" button and when the player clicks the button I want the ...
1
vote
2
answers
437
views
checkpoints c# in unity
i am making a game with c# in unity and i want that if you die in level 4 that you go back to level 0 but if you are in level 5 that you respawn in level 5
the code:
{
int currentSceenIndex ...
0
votes
1
answer
759
views
How to fix unity error CS0176 with scenemanager
My Problem is the following:
I´m trying to code a script for Unity with which I can change the scene when one specific Object was clicked.
But I get the following error:
NewBehaviourScript.cs(19,21):...
0
votes
2
answers
4k
views
scene gets not destroyed when loading another
I have a problem with the ScenManager of my unity android app.
When I start a new Scene the old scene is activ and work but the new scene is shown an work. I want that only the new scene work.
// ...
1
vote
0
answers
4k
views
Unity start() called before scene is fully loaded
I ran into this article Multi-scene editing, and at the bottom of the tips and tricks section, there's the following sentence: "It is recommended to avoid using DontDestroyOnLoad to persist manager ...
0
votes
1
answer
112
views
Is there a way to set a scene's content to a variable?
I have a game where I need to save a scene. I'm doing this by setting the scene to a variable which I can access later. The player then goes to a main menu when they are done.
The player now wants to ...
1
vote
1
answer
109
views
Saving all scene content through script
I've been working on a game, and one of its features is being able to create a level. However, I'm having some trouble on how to save the level the user has created.
I'm thinking of duplicating the ...
0
votes
0
answers
157
views
How to make the restart button work after the game
I'd like the restart-button to work after the game, not only during the game. The button is there (visible) during the game, but it only works during the game. Whenever "gameOn is false, the button ...
0
votes
1
answer
1k
views
Why doesnt my scene finish loading Unity?
Hi I'm currently developing a game in Unity and I run into a small problem for some reason the fourth scene I'm creating(Level 3) gets stuck and doesnt finish loading preventing my game from ...
2
votes
2
answers
9k
views
How to prevent the reload of already loaded gameobjects in Unity?
I'm currently developing a game in Unity and I ran into a small problem. I'm working on a restart function that gets called automatically when the player dies and loads the first scene again. However ...
0
votes
1
answer
2k
views
Unity iOS crash when unloading assetbundle scene
I have separated some mini games in another project to load them all in one project. I have created asset bundles successfully with Unity 2018.4.9 version and put them into StreamingAssets folder. ...
0
votes
1
answer
3k
views
How can I make a method that runs before any scene is loaded?
I'm currently making a game in Unity and I ran into a problem. Essentially what I'm currently trying to do is load a huge list of objects that I require for future scenes in my Recource folder and ...
0
votes
1
answer
4k
views
How to change scenes in Unity with any input (key pressed or mouse clicked)?
I'm trying to change the scene with any key pressed or mouse clicked but it doesn't seem to be giving any response in-game.
I've tried the most common solution to this on the internet :
using System....
1
vote
1
answer
1k
views
How can adapt my object pooler to reset for each new scene that I load?
After updating the game according to the specifications given in the answer I now get the following error message:
Assets\ObjectPooler.cs(79,41): error CS0103: The name 'pool' does not exist in the ...
3
votes
1
answer
2k
views
How to preserve the full state of objects between scenes?
When loading a new Scene I run into the trouble of having my mouse drag not carry over to the next scene and having to re-click when the new scene is loaded.
I would like the mouse click to carry ...
4
votes
3
answers
3k
views
How to fix unintended scene buildIndex of -1 in Unity
Essentially, after testing a few level prototypes, I've decided to stick with my current game idea so I started creating a GameManager to control the flow of levels, etc. I don't have any additional ...
0
votes
1
answer
120
views
How to load the right scene
Hey I am making a gameover screen for my game. I want it to get gameover screen, then when player dies it restarts that level. I made it in a inefficient way making multiple gameover screens then ...
0
votes
0
answers
1k
views
Coroutine couldn't be started because the game object 'Scene Loader' is inactive [duplicate]
I have already searched in the Internet, also this link, and this link but didn't find the specific problem I have now.
I have a main scene with 2 buttons, where each button should open other scene (...
0
votes
1
answer
82
views
How can I change scenes when 2 different player objects are inside a door's trigger at the same time? [closed]
There are player GameObjects which must have different tags: "Player1" and "Player2". There is a door GameObject, where if both players are inside the door's trigger, the scene will be changed.
0
votes
1
answer
2k
views
Unity Android Build - error on change scene
I'm facing a rather odd problem, I'm using unity 2017.3.1f1 Personal.
When I build the APK and I copy that file to the phone and install it from the phone's file manager, I can't switch from the main ...
0
votes
0
answers
114
views
SceneChange script compiler error: unable to access due to protection level
I have this script that allows me to change to a different scene when I push a button. I've used it multiple times before with no issue, but recently I've been getting this compiler error that's ...
2
votes
2
answers
8k
views
Unity scene switching takes too much time
I have created a game with a main menu in a scene and I have a second scene that has the actual game in it. When the user taps the play button on main menu scene it loads the actual game scene but the ...
1
vote
2
answers
3k
views
How to access gameobject present in another scene [duplicate]
I am creating a simple number guessing game in unity3d.
I want to open a new scene on button click and change the text of a text element present in the loaded scene from the current scene.
I have ...
0
votes
1
answer
2k
views
UNITY Cant change transform.position after loading scene
i have a some problem with my C# scirpt. So, the problem is after loading the scene, obj is moving to starting position on scene, not to the one i set. Can someone help me with this super hard ...