#This is my main menu, it is very small

1 messages · Page 1 of 1 (latest)

toxic swallow
#

How have you got this set up?

late needle
#

In a new scene

toxic swallow
#

Check your canvas component for it's scaling mode.

#

What does it say here

late needle
toxic swallow
#

Great

#

so for your background image, what is the anchor settings?

#

This thing up here

late needle
#

Stretch - stretch

toxic swallow
#

that should do it

#

if you hold alt and shift and click on the bottom right, what happens?

late needle
#

It just went smaller

toxic swallow
#

Are you looking at the scene view or the game view?

late needle
#

Game view

toxic swallow
#

Is it not filling the game view?

#

What's the canvas render mode?

late needle
#

Screen space - Overlay

toxic swallow
#

That's all correct, is the background image still not filling the screen?

late needle
#

Nope :/

toxic swallow
#

What does the background image look like in your assets folder?

late needle
#

I have set it to Sprite

toxic swallow
#

Try a different sprite and see if you get the same result.

late needle
#

What if I remove the source image from the background image?

#

The main menu is in a new scene

#

When I start the game, the menu fails to appear

toxic swallow
#

When you say 'start the game' do you mean 'enter play mode' or are you making a build?

late needle
#

Enter play mode

toxic swallow
#

But you can see the menu in the game view in edit mode?

late needle
#

Yes

toxic swallow
#

Are there any scripts in the scene?

late needle
#

Only 1

#

It is the main menu script

toxic swallow
#

!code

oak radishBOT
toxic swallow
#

Can you share it with me?

late needle
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class MainMenu : MonoBehaviour
{
    public void PlayGame()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }

    public void QuitGame()
    {
        Application.Quit();
    }
}
toxic swallow
#

This is fine, nothing here should make your menu disappear

#

Are the buttons hooked up to these methods?

late needle
toxic swallow
#

This all looks correct. I'm not sure why you're having any issues. Can you tell me again what the problem is?

late needle
#

Yes, when I start my game from my actual game scene, the main menu scene should pop up but it does not

#

Unless I am meant to build it in the build settings

#

Or

#

There could be an issue with the camera

toxic swallow
#

Have you added the menu scene to your scene list in the build settings?

late needle
#

Yes

#

I made a new blank scene for the main menu

toxic swallow
#

Can you show me the scene list?

late needle
toxic swallow
#

That's showing the scenes in your project

#

You need to open the build settings

#

to add a scene to the scene list

late needle
toxic swallow
#

Great that looks good

#

open the main menu scene and enter play mode

late needle
#

It is being displayed like that and the button do not function

toxic swallow
#

Can you double check all the above canvas settings for this UI

#

because if you have a correctly anchored, scaled and positioned image you should't see any skybox

late needle
#

For some reason I am :/

#

My main menu is not stretch - stretch

#

My canvas is

toxic swallow
#

The canvas shouldn't have any editable anchor settings

late needle
#

Oh, yes it does not

#

My bad

#

I meant the background image

toxic swallow
#

Show me the settings for the background image

late needle
toxic swallow
#

try setting th escale to 1,1,1

#

you see where it's 0.2022

late needle
#

Alright

#

That does look better

toxic swallow
#

Ah great

#

does it fill the screen now?

late needle
#

Yup

#

However, the buttons do not work :/

toxic swallow
#

Show me the button setup?

late needle
toxic swallow
#

Looks ok at first sight

#

can you put some debugging in your PlayGame() method to see if it actually gets called?

late needle
#

Okay

#

Hm, it is not being called

#

Oh

#

Wrong script/script name

#

Nvm

#

Yeah, it does not work

toxic swallow
#

The method is never called?

late needle
#

Nope

toxic swallow
#

Does the button animate? Do you get that red color change from your button script?

late needle
#

No

toxic swallow
#

Perhaps create a new test button and make no modifications other than hooking it up to your script

late needle
#

Does not work either

toxic swallow
#

Any color change?

#

Wait, do you have an input module in the scene?

#

One gets added for you when you create the canvas

late needle
#

I don't think so

toxic swallow
#

You'll need one of those.

late needle
#

It works now

#

Thank you so much for your help 🙂