1
votes

I am a beginner with Unity3D.

Until now I have learned a few things.

For example, create a simple 2D menu, switch from one scene to another with an appropriate C# script and associate the scripts with the objects.

The problem I pose here is about the behavior (strange to me) of the white panel behind the menu when I change the scene.

I have two scenes, the first which is the menu and a second one is the actual game.

I used UI elements to create the first one, while I used 3D objects to make the second one.

So, what happens?

It happens that when you step into the second scene by clicking on the green button the background becomes brown. If, on the other hand, I run the second scene individually without going through the first one (launching the scene directly), the background remains white.

See this short video for further details.

Why?


Listed below are some images, hoping they can help me understand my problem.

The first scene (dev mode): enter image description here

The first scene (running): enter image description here

The second scene (dev mode): enter image description here

The second scene (running directly): enter image description here

The second scene (running after clicking the green button "Comincia"): enter image description here

The script I use to change the scene (linked to the green button):

using UnityEngine.SceneManagement;
using UnityEngine;

public class GameScene : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    public void PlayNow () {
        SceneManager.LoadScene("Game", LoadSceneMode.Single);
    }
}

Update: I have updated the information on the application. I added a new screenshot where you can see the camera settings. Meanwhile, I changed some things, but the problem still remains. I also noticed that this problem only happens when I switch to the Game scene, when I switch to other scenes instead it does not.

Added a new screenshot showing the inspector of the Main Camera object: enter image description here

1
This is probably related to some kind of setting in the inspector. There is no way the code you posted could have anything to do with it. I would start by checking the camera. There are setting in the camera, including one to show a static color as a background. Maybe that part is changing? If not, it's guesswork.Tyler S. Loeper
Thank you so much for your consideration, I'm working in the hope of being able to solve the problem. In the meantime I posted a new screenshot with the Main Camera information.shogitai

1 Answers

0
votes

I was able to understand where the problem was: I made an improper use of the Plane object (highlighted in the screenshot). By removing it, now it shows correctly the solid color white background as set on the Main Camera.

enter image description here