C
C#•8mo ago
O.

Video game dev bug

Hello, I am currently creating a game and I am having a problem, can someone please help me, I will send you below the 3 photos of my problems, thank you if you can help me
No description
No description
No description
18 Replies
Angius
Angius•8mo ago
You never seem to instantiate the inventory
O.
O.OP•8mo ago
What should I add to solve this problem?
Angius
Angius•8mo ago
Create that instance
O.
O.OP•8mo ago
And how do I do it? Sorry I'm really new to coding
Angius
Angius•8mo ago
C# for beginners, chapter 3: new Foo() creates an instance of Foo If you're new to C#, I'd advise against learning with Unity $helloworld
Angius
Angius•8mo ago
You should start with simpler projects
O.
O.OP•8mo ago
with others I could create video games?
Angius
Angius•8mo ago
What I mean, is games are very complex, and usually require at least the basic understanding of the language you're using Like, say, aspiring to be a world-class chef requires you to know how to hold a knife, for starters So, it's a better idea to learn from smaller, less complex, non-game projects And once you know C# enough, then you can get to making games
O.
O.OP•8mo ago
I'm not much into coding, I just want to develop a video game, if I could avoid coding I would, so I'm learning on the job.
Buddy
Buddy•8mo ago
Note that you should not do that in Unity, not to call new Foo(); on an object inheriting UnityEngine.Object You are missing a reference to coinCountText Check the inspector of Inventory script
O.
O.OP•8mo ago
where ? How do I repair it? please
Buddy
Buddy•8mo ago
When selecting the gameobject that has the script In hierarchy
O.
O.OP•8mo ago
I don't really see where it is
Buddy
Buddy•8mo ago
Screenshot Unity please Entire editor
Angius
Angius•8mo ago
"I'm not much into music, I just want to release an albm"
O.
O.OP•8mo ago
ok it's good I managed to resolve the problem with another member of the discord thank you anyway 🙂
tatoie dardmeladze
tatoie dardmeladze•8mo ago
to create instance of inventory you can use
Inventory inventory = new Inventory();
Inventory inventory = new Inventory();
at leas in c # coding to create instance of class you need to do that idk if that corrects for game development but try it . I am also beginner and also make sure instead of Inventory.Instance() you type inventory.Instance cuz when I made innstance I used lower case also make sure to seek help from other since I gave you probably wrong answer idk you can check it tho and the code I have just send you can use in ontriggerEnter2D
Want results from more Discord servers?
Add your server