#Thread

1 messages · Page 1 of 1 (latest)

rose elbow
#

ya. delete that one.. i think i forgot to add the singleton to it

ruby bronze
#

oh ok

rose elbow
#

i'll send u a newer one..

#

i told you i broke it while i was working on it 😅

ruby bronze
#

okey

#

Is it maybe smart to show you what i am working on and then you know the context etc?

rose elbow
#

probably best to show as much info as possible all the time when asking for help..

#

i feel like u might have skipped some basics as well 😐

#

and started straight into stuff u dont fully understand.. tbh

ruby bronze
#

could be

#

I started with a book Unity for "anfänger" (beginners)

#

And thenI thought lets just make a 3D Game, and learn while doing it

#

Do you maybe know how to make it that when I click smt in game it teleports me to a different scene?

rose elbow
#

here's a fixed one that doesn't try to use my SPWN namespace.. even tho i had it included in the first one..

ruby bronze
#

alr let me try in a few mins i finish the one tutorial real quick

rose elbow
#

no prob..

ruby bronze
#

ok now

rose elbow
#

i sent Alll that.. basically to say ur issue w/ the pause menu and the button is that ur pause menu probably never makes the cursor state back normal so u can click the button.. and step2 came naturally that to make sure this stuff is done easily is to have only (1 set) of code that does ur locking and unlocking/ hiding/not hiding cursor stuff

https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Cursor-lockState.html

ruby bronze
#

tut works :D

rose elbow
#

👍

ruby bronze
#

now yours hold on

rose elbow
#

hey. atleast i got mine to recycle all across my many many projects 😄

ruby bronze
#

well

#

16 errors

rose elbow
#

mines a bit more geared towards scaleability since u cal call the singelton from anywher

ruby bronze
#

sorry 18

#

and 1 warning but thats mine

rose elbow
#

ohhhhh..

#

i dont remmeber sending those..

#

this is all thats in that package..

#

\PAK\ folder shouldnt even have anything in it

#

OHHH

#

i sent worng file again

ruby bronze
#

what is yours what is mine? my organisation is a mess

rose elbow
#

SPAWNKIT is a bigger project

ruby bronze
#

too much

rose elbow
#

delete \PAK\

#

and anything that says SpawnCampGames\

ruby bronze
#

Pak deleted Minus 6 errors

rose elbow
#

the other 6 are what?

#

surely not mine

ruby bronze
#

is this yours?

ruby bronze
rose elbow
#

yes TF delete that one too

#

all the TF stuff delte

#

u have 3 folders looks like

ruby bronze
#

all errors gone

#

two TF and some numbers and one Pak Folder

rose elbow
#

theres some more stuff.. if u have AntennaSpring folder delete that.. then Pak. the two TF folders..

#

SpawnCampGames folder.. and Extra folder

#

and then u should have it cleaned up... i cant believe i sent the wrong file 🤦‍♂️

#

you should have caught it too... lol the name isn't even anything to do w/ Pause haha

ruby bronze
#

i just thought holy shit is that much

rose elbow
#

look how far apart they are

ruby bronze
#

cant find the other folders

rose elbow
#

i cant believe it (╯°□°)╯︵ ┻━┻

ruby bronze
#

but no errors anymore

rose elbow
ruby bronze
rose elbow
#

no.. like little.. ^ i showed up above

ruby bronze
rose elbow
#

you'll be able to read everything better

ruby bronze
ruby bronze
#

🙂

rose elbow
#

use the slider

ruby bronze
rose elbow
#

okay.. yea none of that is mine

ruby bronze
rose elbow
#

nope

ruby bronze
rose elbow
#

Test may be something.. but everyone names stuff test..

#

WhiteIconPack is mine

#

thats it..

ruby bronze
#

is yours i think

ruby bronze
#

test also deleted

rose elbow
#

THIS is the right file.. but if that tutorial works

#

why bother

ruby bronze
#

was a tut about a other topic

rose elbow
#

ohhh..

#

check first before u upload

#

you can see what files are coming in.. this one should only be 3 scripts and a scene

ruby bronze
#

sure?

rose elbow
#

3 scripts.. and 1 scene.. yup

#

looks right

ruby bronze
#

looks good

rose elbow
#

and that scene should work w/o any errors

#

if theres errors i give up lol

ruby bronze
rose elbow
#

yea open pausetest

#

in the pausesystem gameobject theres a place to chose which key pauses the game..

#

well which one opens the menu..

ruby bronze
#

ehm

rose elbow
#

u can chose w/e but like i was saying earlier.. its nice to test w/o using the escape key

ruby bronze
#

20 errors

#

21 sry

rose elbow
#

noooo way!

ruby bronze
#

just kidding!!!

#

Works very well

rose elbow
#

theres not even that much code

ruby bronze
#

Very Very Very WELL

rose elbow
#

👀

ruby bronze
#

number

#

so how do I intigrate that now tho?

#

I moved that now to the "serious shit" folder so I can find it more easily

rose elbow
#

the CursorController.. u just set that how u want it when the game starts...

ruby bronze
#

umhm but on what gameobject?

rose elbow
#

then.. anywhere in ur script u can call CursorController.Instance.Lock();
or.. .Confine .UnConfine

ruby bronze
#

can I copy paste your scene thingy to my scene(s)?

rose elbow
#

.Hide() etc.. u can see an example in the PauseSystem script

#

wheere mine says MasterMouse.Instance urs would be CursorController.Instance

#

and if u open that script.. theres ALL the different functions u need..

#

that way.. when u pause or unpause or ur controller needs to hand over the mouse or w/e u can just use that same line in those scripts

ruby bronze
#

can we maybe screenshare and you show me or smt?

ruby bronze
rose elbow
ruby bronze
#

how late is it where you live? for me its 8:30 pm

rose elbow
#

check it.. you just need those couple of gameobjects.. put it in any scene u already have..

#

add scene -> copy over gameobjects -> remove scene without saving

ruby bronze
#

like all things in your scene copy then my scene paste and pow it works?

rose elbow
#

the only issue you may have is if u already have an event system.. you only need 1 of those.. the pause system gameobject needs a reference to it.. whichever one u chose to keep..

ruby bronze
#

then i choose yours ig

#

can I change your first not pause canvas to mine without an issue?

rose elbow
#

u can use whatever EventSystem you want... i just had to include one w/ the package

#

my ButtonTester script uses it to unfocus the button after u click it.. thats all it does.. u dont even have to use the ButtonTester script

ruby bronze
#

wait a minute

rose elbow
#

and last thing to mention really is.. in the pause system script.. (since in my example thats whats controlling everything, like the menu, and telling the cursormanager to lock and unlock) it needs to also do the other things..

#

like in the vid example ^ i would tell my character controller when it can and can't move.. as well as other scripts like the camera controller.. not the other way around..

#

in ur scripts u sent.. u had the character controller changing the cursor itself..

#

but thats how most tutorials do it.. b/c they dont have to build the entire game w/ all the systems working together

ruby bronze
#

but the game needs to be paused completly?

rose elbow
#

yea.. u'll need to add the time stuff.. i mentioned that i never added time.. scaling..

#

b/c i dont really pause that way

#

i'd like my time step to continue while i have things paused.. the pause system can be added onto.. like i was saying to stop the character, stop anything else that needs stopped..

#

u can add in the timescale stuff in there if u need to

ruby bronze
#

but it works awesome tbh

#

!!!

rose elbow
#
        if(Input.GetKeyDown(PauseKey))
        {
            if(isGamePaused)
            {
                //game is paused, lets unpause it
                CursorController.Instance.HideCursor();
                CursorController.Instance.LockCursor();

                //disable the pause menu
                pauseCanvas.SetActive(false);

                //mark our system as unpaused
                isGamePaused = false;

                //set your time stuff to 0
                //myCharacterScript.canMove = false;

                Debug.Log("We've successfully unpaused the game.");
            }
            else
            {
                //game is unpaused, lets pause it
                CursorController.Instance.UnhideCursor();
                CursorController.Instance.UnlockCursor();

                //enable the pause menu
                pauseCanvas.SetActive(true);

                //mark our system as paused
                isGamePaused = true;
                Debug.Log("We've successfully paused the game.");

                //set your time stuff to 1
                //myCharacterScript.canMove = true;
            }
        }```
ruby bronze
#

I changed the Design a bit and it now looks so good and the buttons actual work

rose elbow
#

thats fine.. its just an example afteer all

#

use it however u need 🙂

ruby bronze
rose elbow
#

its the pausesystem script in that package

#

have u not looked at all the stuff in there yet?

ruby bronze
#

i do now

#

but why do you sended it here?

rose elbow
#

i was showing u where /how ud do the timescale stuff

#

since u mentioned it..

ruby bronze
#

if (GameIsPaused)
{
Resume();
}
else
{
Pause();
}

can I paste it in your pause manager?

#

wait no

#

wrong

#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class PauseMenu : MonoBehaviour
{
public static bool GameIsPaused = false;

public GameObject pauseMenuUI;

void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        if (GameIsPaused)
        {
            Resume();
        }
        else
        {
            Pause();
        }
    }
}

public void Resume()
{
    pauseMenuUI.SetActive(false);
    Time.timeScale = 1f;
    GameIsPaused = false;
}
void Pause()
{
    pauseMenuUI.SetActive(true);
    Time.timeScale = 1f;
    GameIsPaused = true;
}

public void LoadMenu()

{
    Time.timeScale = 1f;
    SceneManager.LoadScene(0);
}

public void QuitGame()
{
    Debug.Log("Quitting game...");
    Application.Quit();
}

}

#

Almost that whole stuff

rose elbow
#

not sure how well copying and pasting thigns back and forth gonna work out..

#

thats why i sent mine in an example scene solo.. jsut so u can get a feel for how it works together in that one little scene..

ruby bronze
#

okey

rose elbow
#

u can then write ur own.. or adapt it however u need

ruby bronze
#

im trying now

#

thanks a lot!

#

!!!!

rose elbow
#

good luck..

ruby bronze
#

thanks!

#

quit button works

#

main menu button works

#

now working on resume button

#

thanks again

#

@rose elbow everything works fine!!!!

#

Thanks

#

Wait I cant Pause the game again after I unpaused it

rose elbow
#

well..
pauses and unpauses as it was..
only thing i can think of is you're unpausing some other way besides the pause key thats setup..

#

if its anything its b/c the boolean isn't getting set back to false when u unpause it

ruby bronze
#

wait its a mistake from me

rose elbow
#

otherwise it'll just try to unpause it again

ruby bronze
#

the other script said its escape again

rose elbow
#

ahh.. escape is such a bad key..

#

ahh yea chagne that to w/e u want

ruby bronze
#

how do I change it so i can change it in unity editor?

rose elbow
#

leave it blank

ruby bronze
#

blank?

#

only the word Escape

#

or KeyCode.Escape

rose elbow
#

public KeyCode PauseKey;

#

no nothing..

ruby bronze
#

ok

rose elbow
#

leave it empty.. and just assign it in inspector

#

gotta run.. 🍀 probably be back on later

ruby bronze
#

hmmm still doesnt work

ruby bronze
rose elbow
#

start debugging as much as u can.. try to step thru it piece by piece and find something that might not be working exactly how u think it should..

#

thats the best i advice i can give for now 💪

ruby bronze
#

how late is it for you

#

bc for me its 9 pm i gonna go to bed in a few hours so...

rose elbow
#

oh btw... the pausesystem script isn't a singleton like the cursormanager is..

#

if u reload scene's its not gonna be there anymore..

#

unless u have one in each scene... or if u make it a singleton like the cursormanager is

ruby bronze
#

I DID IT

#

Call me a god (well half god bc you are god)

#

But I did it

#

the other script was like wth are you trying nah you need to do this and this and this to use me but use me i am in your script

#

I deleted him and his friends and then powe