#Heyo it s me again I fixed the previous
1 messages · Page 1 of 1 (latest)
Basically part of UI is missing because I disabled it because it’s on DontDestroyOnLoad and now I dunno how to enable it because my game manager is also on DontDestroyOnLoad
which UI
and in the future please use something like OBS or ShareX to record your screen
I will
Level 1 sign and the egg and the counter were all loaded into main menu and level select
the script?
yeah
It's called BackToMenu script that another guy made
Because basically UI and menus are supposed to be their job and gameplay and level design is supposed to be mine
okay, can you please show me that script..?
why do you need to set the text to DDOL though
Wdym DDOL?
Dont Destroy On Load
i think I know the issue. your GameManager loses reference to the text
it's better if you dont make the text belong to the GameManager. Just put it in a script that's in the level itself
you already can get a reference to the coins easily because GameManager is a singleton
so you separate the counterText from GameManager, then you don't need it to be DDOL
then you dont need to disable or enable it
so in case you dont get what I just said. you declare another script that holds your counterText. you remove it from your GameManager.
This script, you put into a GameObject that's only in your Level. it doesn't need to be DDOL
this counterText script can get the coins variable from your GameManager
Okay thank you will try it
To be honest I don't struggle writing code for the game play that much but when it comes to the menus 'nd stuff it just messes with my head
so "eggNum.text = " 0 / 12";" this line should be added to another script?
yes. your egg counter text should be handled by another script that's only in the game scene, and not DDOL
so you dont have to worry about it being shown outside the game
and your GameManager doesnt need to hold the reference to it
Okay did it, now the counter and level text disappears like it needs to
But counter doesn't increase after I restart the level
I had that problem before
you're saying Debug.Log("Dodaj en koinic"); doesnt work?
does that print?
what do you mean the counter doesnt increase
is it that the text doesnt update?
Yeah it does, everything in code that adds coins works, it's the UI or UI script itself and I forgot how I solved it before
or that coins doesnt go up
Yeah once I restart the level it says 0 / 12
and it doesnt go 1/12?
Nope, not once I restart it
the easiest way is to just set the text in Update
But debug works for adding coins
the better way is to use events/delegates
how about you show your countertext script
i will have to go soon
but i think you could just update the text in Update?
Not really
Sign up for the Level 2 Game Dev Newsletter: http://eepurl.com/gGb8eP
The Singleton Pattern is a design pattern that's well-loved by Unity game developers. But, unfortunately, it has some serious drawbacks that most programmers don't discover until it's too late. In this video, I'll show you what those drawbacks are so you can avoid them in the...
it means you can easily access it through its static property
like you have this public static GameManager Instance { get; private set; }
and you dont even know what it's for
you could just do eggNum.text = GameManager.Instance.coins.ToString() + " / 12";
you dont need public GameManager gameManager;
i suggest you actually learn what you just did
i have to go now