My attempt at the obstacle course :)

Hi guys, this is my attempt at the obstacle course game. Not great I know, but I’m absolutely loving the new course so far, I have learnt so much in just a short time and can’t wait to keep progressing to more exciting new projects :smiley:

6 Likes

Hey great job! I just finished that part of the course and getting ready to make something like you did with my own spin on it.

I listed out the different scripting pieces and trying to sort out what I learned so far. One thing I’m not clear on is the ‘renderer’. When I reference the scripting API for 2020.1, it shows from Component.renderer which is obsolete. Are you also having a bit of trouble understanding the code? I’m trying to see if that’s just me struggling or if everyone has a bit of trouble with it. I’m not quite seeing it yet but maybe it will click.

Once again, great job. This looks like it will be a lot of fun to learn.

1 Like

Very nice looking course, well done :slight_smile:

1 Like

Hi, i guess Component.renderer was used in the past since its obsolete,
its now;

GetComponent<Renderer>();

Ok, thank you. I think I’m being a little slow to pick up the concept. So Renderer is a Class and it Inherits from Component. Component is a Class that Inherits from Object. And Object is a Class in the CoreModule of Unity Engine. Sound right?

1 Like

Im still learning myself, but i guess you could call renderer a class. In unity thats just called a component as far as i know, which is on a gameobject in the scene. So if you want to access the renderer component on that gameobject, you GetComponent, in this case renderer. You also access other components/classes on gameobjects like this.
I found on top of doing the GameDev courses, when i feel like im a little slow on the uptake,
i see if Unity has some more on the subject, maybe this helps a bit? GetComponent - Unity Learn

Got it, thanks. I checked out the link on Unity Learn. Good tip and it was worth the extra 5 minutes. I think I have the concept, thanks.

Hey Dan, only just seen this sorry :slightly_smiling_face: first of thank you for your kind omments man, very much appreciated. Secondly, I saw someone beat me to the post in answering your query, lol.
But yeah, if you just remember that all components are simply classes with associated properties and methods, and they provide a visual representation in the inspector window, you’re all good :blush::+1: if there is anything you get stuck with or need any advice on when you come to make yours, just give me a shout man and I’ll do my best to help :sunglasses:

1 Like

Thank you so much man, that’s very kind :slightly_smiling_face: I found it hard getting balance of being challenging but too hard at the same time :grinning_face_with_smiling_eyes:

Hey Ash, no problem at all.

Regarding the classes with properties and methods. That’s a good way to think about it, thanks!

I’m slowly putting together an obstacle course. I decided to learn about triggers. Not sure if I’m doing it right but created a trigger manager script to handle audio and various other tasks. Basically just having fun tinkering around with it. :slight_smile:

1 Like

Hey Dan, that is absolutely the best way to do it. Experimenting with things is the key to getting the most out of your learning :smiley: and if you’re having fun when doing something, it just makes the learning process a whole lot easier and faster because your brain is fully engaged in what you’re doing!
A part of me wants to go back and start it again, lol. I’m trying to the think along the lines of, “if Nintendo made a Mario game based on this project”, what would they do to make it unique. So then I start thinking, instead of trying not to hit X amount of walls when getting from A to B, what about collecting X number of items around the course before getting to the goal?" and “maybe have some moving platform which requires patience and timing from the player before they get across?” and then I think, “Ash, maybe you’re overthinking this for your first project” :laughing:
Seriously though, that kind of thought process will aid you in coming up with some new interesting approaches to your game :slightly_smiling_face:

I hear ya, I think Unity Dev is a great way to learn C# vs just learning vanilla C#. This multidisciplinary environment with immediate feedback is a lot of fun for sure. I switched to 2021.1 and it is really tempting to mess around with visual scripting as well as C#.

I’m with you on redesigning the game and doing something new. I have probably gone well out of scope several times already as I try to think of different designs. I started by making a spreadsheet showing everything learned with a plan on just using those items, plus a few more, to make something new. But, after I almost set out to build an Army confidence course, I decided I better just do something much easier so I can move forward in the course :slight_smile: I simply don’t know enough.

I like your idea of collecting rather than avoiding hitting walls and various obstacles. I also spent some time with a First Person controller that I downloaded from the Asset Store. I liked that perspective but since I didn’t understand the code, I decided against it.

After all of that, I decided on just doing one level, similar to the design in the course, with an all metal theme. Then just move forward in the course with a plan on circling back to this one when I have more knowledge.

One thing I’m noticing while coding in C# is having to move the curly brace down one line when creating a method. It automatically places one curly brace on the same line, and another two lines down. I’ve been combing through settings and extensions but not finding a way to place a curly brace on a new line. Anyone here have this problem as well, or do you just leave the curly brace in the default position? I personally like seeing them on new lines.

I know exactly what you mean man. Rick mentions something about that actually, about knowing how much to add it, when to stop etc. and he uses the onion concept (not sure if you’ve seen it yet but apologies if you have and I’m telling you what you already know, lol) he explains about layers of an onion representing features within your game. Start from the core of the onion, your 1st layer would represent the most important feature you would need in your game, such as movement etc, then the 2nd layer represents the next most important thing etc etc. until you reach a point where you can decide whether or not to add any more layers (features) to it, or whether you’re happy at that point to call your game finished :slightly_smiling_face: this is definitely something I’ve struggled with a long time, haha and it makes a lot of sense now when I think about it, I’ve just never looked at it that way before.

Ah yeah, I know what you mean. I have the same issue using VSCode. I tried the suggestion posted here but no joy for me, not sure if it will work for you? robertwray.co.uk - Braces on new lines in Visual Studio Code

Like yourself, I much prefer them on a new line, as it help improve code readability :slightly_smiling_face:

I’m not familiar with the onion concept so glad you’re bringing it up. I’m sure I will probably run across it when taking more of his courses. I do have a habit of wanting to do too much too fast. It does make sense to have as few features as possible, reducing scope, and looking for the mechanic that makes it fun.

I’m a little stuck at the moment while trying to use the Unity Input System. Rather than using the mover script, I setup key bindings and attempting to create a Player script with a Brackey’s video. His video is a bit older so ‘using UnityEngine.Experimental.Input’ is no longer a thing. When I use UnityEngine.InputSystem, then it doesn’t recognize Player in my script. So, I’m kind of chasing my tail. :slight_smile: I’m basically trying to setup WASD, SHIFT, and CTRL for movement, sprint, and crouch respectively.

Thanks for the link. I gave it a try but it didn’t work. It looks like that is for JavaScript formatting. I restarted VS Code after making the changes but no effect on C# code formatting. I’m wondering if I have to explore Visual Studio to get that functionality.

I hear you man, I’m exactly the same. I have an annoying tendency to rush things in order to move onto the next thing. I’m trying so hard this time around to be a lot more self disciplined than usual, to take my time and make sure I understand everything before moving onto the next thing :slightly_smiling_face:

One thing I find helps, is just to bullet list the main points of the current section of the course, it may just be a new method or a new property I’ve not used before. I’ll make a note of it then once I’ve reached the end of the section, I’ll go back to my bullet points and then write little script which uses the said method/property, ensuring it’s the most basic example I can think of (as you know, less code to look at makes it easier to understand and remember) :slightly_smiling_face:

Ah man, when you mentioned Brackey’s, it brought back good memories of following his videos. Still gutted to think he’s not doing any more vids :slightly_frowning_face:

Anyways, in relation to your issue with the getting input from the WASD, SHIFT and Ctrl keys, you can access those by using the following:

So for example, if you want to test if the W key is being held down, you would simply say:

if (Input.GetKey(KeyCode.W) {
    Debug.Log("The W key is being held down");
}

Hopefully that should be what you’re looking for mate :slightly_smiling_face: :+1:

Yep, I agree, here’s to a better understanding before moving on to the next thing :beers:

Making a bullet point list and practicing those items sounds like a great plan.

I see that Brackey’s stopped awhile back. I’ve only watched a couple of his videos but I have it on my list to go through his material. Even if some are dated, I’m sure there’s some really good information in there. Did he mention why he stopped teaching?

Regarding WASD, SHIFT, and CTRL keys, thank you for the code. I appreciate it. I did find that in the scripting API and it shows that it is a little better to use Input.GetAxis and Input.GetButton. However, I am trying to do something a bit different right now by using the new(ish) Unity Input System. This makes it user configurable and cross platform without coding. Most of it seems easy to understand except the last bit on how I write the code to use it. Thanks to Brackey’s I had 99% of it but something was going wrong. So I deleted the scripts and will start over. I did find this video and only started watching it. It might answer my questions.

Overall, what I’m shooting for is the user picks up any compatible device and it works. Nothing is hard coded to a specific device, all the bindings are done in the editor without coding and then Unity generates the code. Then, just one last piece of code to use it. I think in this case it is more efficient than a programmer writing code each time to solve a common problem. At any rate, interesting to learn.

I’m pretty sure Brackey’s just reached a point where he felt the need to step down and give himself time to do other things he wanted to do, as I can imagine all the time spent researching Unity stuff, recording videos, creating games, answering comments etc, was taking a huge amount of time out of his days, lol :slightly_smiling_face: Here is his final video though and it should explain everything: GOODBYE - And thanks for everything! - YouTube he also makes some good suggestions for other Youtubers to follow in order to continue your learning with Unity etc, so may also be a good idea to check those out :slightly_smiling_face:

Ah sorry man, I had a feeling my answer regarding the input thing was wrong, my bad :see_no_evil: I see what you mean now. In all honesty, I never even knew about this new functionality existed and it’s certainly opened my eyes, as I’ve always thought about how to add control once so it works across all platforms :slightly_smiling_face: I’d be interested to know how you get on with that one actually. If you could let me know once you’ve got it that would be great. Likewise, if by chance I can crack it on my side I will be sure to let you know man. That video link definitely looks like a step in the right direction with this though :slightly_smiling_face:

Thanks for the link. I’m sure it was a lot of effort for several years for sure. I will definitely check out the videos at some point. For now I mostly want to stay in the lane of learning from Rick, Ben and Sam. It will likely take quite some time to get through all of the Unity courses. Particularly the RPG courses. Circling back to Brackey’s after that sounds like a good use of time.

No problem regarding the input system. I’m learning all of this stuff too and I appreciate any feedback and tips you have along the way. Awhile back I purchased Rewired and it handles all of that stuff automatically. But, I’m not learning when I do that so trying to understand it better. Although it might not be a bad idea to look at Rewired at some point to get a better understanding of the code and how they solved the problem.

You bet, I’m always happy to share anything I learn that may be helpful to someone else. And I do appreciate your offer to do the same, that’s cool and helpful. I don’t know if there is a collaboration tool with GameDev.TV. If so it might be easier to chat that way. I also have a Slack channel that I created that anyone is welcome to join. It has one person in it, which of course is me :slight_smile: I think I had a conversation or two with Slackbot. :slight_smile:

Privacy & Terms