Can somone help me please?(Play/change scene script)

i have tried 5 different scripts. i cant figure out how to change my scene in my main menu to my other scene. i also want to create a second small menu and a control where if i click esc, it will pull up a pause menu to be able to exit the game, or to save, or other things. i will be thankful for anything people can give me. Although i would not perfer half completed scritps. If you have one that may be useful then thank you and post. Also i am having an issue with my unity. i have reinstalled 5 times, and wiped unity. will post in a new thread.

See… we’re not writing your game, we’re writing our game.

We don’t know what goes into your game, or what your scenes are named, or what the UI, or any of that stuff.

There’s a simple ONE LINE of code to load a scene, it’s called the LoadScene method on the SceneManager.

You know that old saying:

“Give a man a fish, he eats for a day… teach a man to fish, he eats for a life time.”

Yeah… so, go read the documentation AND LEARN TO CODE:

Also…

Wat?

How about a link to said thread? How about some more information?

HOW ABOUT YOU LEARN TO USE PARAGRAPHS!

thx for your opinion, btw i’m using unitys’ script, because i’m testing my editor because there may be a bug in my installation, so if you have any helpful criticism i would be glad to hear it. otherwise plz, help yourself to the back button. btw im only 14 and ive been programming for 3 years and studying ap bio for 2. have a nice day sir.

Your being 14 doesn’t forgive you from what is essentially ‘code begging’.

Actually I find it more egregious.

And I gave you helpful criticisms.

  1. learn to code

  2. learn to read documentation

  3. learn to not ask for a result, but rather to ask for direction on finding your result

  4. learn to phrase your request in a coherent statement and adequate grammar. Rather than a giant run-on paragraph.

code begging, really, just because i have posted a forum report on a potential bug and an issue on my installation. how about you look into the fact that i may be a little bit more inexperienced than you. Also the fact that i may have a bad computer that cant install unity correctly so i have to go with what i have. so i have to figure out the bugs for myself. because i cant post on the forum, because there is something wrong with my unity, thus i cannot come to a positive finalization. how about you help instead of hinder. thank you

and a giant run on paragraph full of information, hinders you cognitive capacity to be able to coherently understand my sentences. well i’m sorry, i will try to solve that problem…

OK, so I’m going to break this down for you so that you understand how forums tend to work. Forum members get very annoyed by what is considered rude behaviour on a forum. Often they’ll spit back at the perceived rude behaviour with contempt and condescension.

So, since you’re admittedly not as experienced in these things, I’ll try to explain where our paths crossed negatively.

Your post did not report a bug (you tacitly mentioned an issue, and we’ll get to that later).

Your post was asking for a script that changed scenes.

Furthermore you requested it by requesting:
Although i would not perfer half completed scritps.

This conveys to me that you want someone to write a COMPLETED script that does what you requested. That you want code that you can just copy-paste, and it works. (and more egregiously, you failed to even fully describe what it is you wanted in detail… so how could one even include a ‘complete’ script???)

We call that code begging. Because you’re not asking HOW to do something, but rather for us to just do it for you. Furthermore you asked it with high expectation.

It’d be like if you were a beggar and walked into a grocer asking for free food… but adding on to your request “and I prefer you don’t give me store brand, I prefer name brand”.

That’s called ‘being an entitled brat’.

It’s rude.

Yes, you aren’t as experienced as me.

Do you know how one gets as experienced as me, or MORE experienced as me?

By not asking for code, but by asking for help in learning.

This ‘bug’ you speak of was an afterthought you appended onto the end of your paragraph that was actually about asking for code.

Furthermore, you didn’t describe the bug. You just said that you’re “having an issue with Unity” and that you “reinstall[ed] 5 times”.

And that you’ll start another thread with that issue.

There is not enough information there for us to respond in any manner. Furthermore you never created said other thread.

It’s like if while I was talking to you about this topic right now and then just mid conversation said “also my meatloaf tastes it bit off, do you know what’s wrong with it? Oh, I’ll just bring this up later elsewhere.”

Wat? Why? What does this have to do with anything? How am I supposed to respond to that?

You seem to be posting just fine on the forum!

Doing my best, unfortunately you’re rather indignant about it.

…

Yes, yes it does hinder my ability to understand, or rather tolerate, your sentences.

There’s a reason your language teacher teaches you grammar and spelling. It facilitates your readers ability to understand what it is you’re trying to say.

Without it…

Well, I get annoyed having to put extra effort into reading your babble. May it only be a slight bit of extra effort, it’s still extra effort.

Why should I?

Why should I give a crap what you have to say?

Make me care!

Speak/write like someone who respects those who are listening.

Not doing so comes off as disrespectful. As rude.

We’re not a free support line for you to abuse. We are a community of members happy to help one another. But why help someone who doesn’t even bother to form a question in any intelligible manner.

Also, by separating your thoughts into different paragraphs avoids confusion, even for you the writer. You try to purport that this post was about reporting a bug, but it wasn’t. It was about asking for code, with a mention of a bug tacked on the end willy-nilly. This jumbling of thoughts has led to a conversation in which you are well convinced that’s what you’ve been talking about the entire time… it’s rather ironic.

I sincerely apologize for my rudness. It will not happen again. Thank you for pointing out to me that I have made a mistake. Can you point me in the direction of a solution for screen transition? Thank you

Sure

When you want to change scenes, you’ll use the SceneManager.LoadScene method:

When you call it is determined by your UI. What event is it causing it to be loaded? Is it because they pushed the ‘Start’ button? Is it because they clicked a specific button screen? Is it because the end of the level was reached? What is causing this effects when you’d call it.

Otherwise though, it’s just that method.

Lets say for instance you’re on a title screen of your game, and you want to load the scene ‘Level1’ when they press the input button you’ve named ‘Start’. It’d be something like this:

using UnityEngine;
using UnityEngine.SceneManagement;

public class LoadSceneOnButtonPress : MonoBehaviour
{
   
    public string SceneToLoad = "Level1";
    public string ButtonName = "Start";
   
    void Update()
    {
        if(Input.GetButtonDown(this.ButtonName))
        {
            this.DoLoad();
        }
    }
   
    public void DoLoad()
    {
        SceneManager.LoadScene(this.SceneToLoad, LoadSceneMode.Single);
    }
   
}

Heck, if you had a button on your screen that when clicked it did the same thing. You could just point the UI Buttons OnClick event at this ‘DoLoad’ method.

You also bring up:

This technically isn’t loading another scene (unless you happen to store your pause menu in another scene so you loaded it additively, but then you would only load additively once!).

How I usually do this is have my pause menu created as a prefab. I put an instance of that prefab in my level scene. And then I just enable/disable the gameobject root of the pause screen to show and unshow it.

Then with some script attached to it in the OnEnable and OnDisable script you do logic for pausing and unpausing. Things like setting the Time.timeScale to 0, and other stuff like that.