Beginning C# with Unity (2023 Edition) - Types
ฝัง
- เผยแพร่เมื่อ 19 ต.ค. 2024
- C# contains lots of different types that you use to build your games. In this episode, you'll get an overview of the simple types and how to use them. Afterwards, there is a brief challenge to test your knowledge.
This episode is sponsored by www.kodeco.com.
Note: Unity is required. You can download the free version from Unity3d.com. This course has been developed using just the personal version.
Kodeco aims to be the best online learning platform for mobile developers at every step of their career, all the way from building your first app, to becoming a respected expert in your field.
Previously known as raywenderlich.com, our products have made a difference in the lives of thousands of developers across the world, helping them to get their first job as a mobile developer, grow their careers as part of a dev team, or create the app of their dreams.
About Unity (from Wikipedia):
Unity is a cross-platform game engine developed by Unity Technologies and used to develop video games for PC, consoles, mobile devices and websites. First announced only for Mac OS, at Apple’s Worldwide Developers Conference in 2005, it has since been extended to target more than fifteen platforms.
It is now the default software development kit (SDK) for the Wii U.]Unity Pro is available for a fee and Unity Personal has no fee; it is available for any use to individuals or companies with less than US$100,000 of annual gross revenue.
On March 3, 2015 with the release of Unity 5.0, Unity Technologies made the complete engine available for free including all features, less source code and support.
Unity is noted for an ability to target games to multiple platforms.Five versions of Unity have been released. In 2006 at the 2006 WWDC trade show, Apple, Inc. named Unity as the runner-up for its Best Use of Mac OS X Graphics category.
About C#:
C# (pronounced as see sharp) is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.
It was developed by Microsoft within its .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006). C# is one of the programming languages designed for the Common Language Infrastructure.
C# is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg. The most recent version is C# 5.0, which was released on August 15, 2012.
6:50 ah yes, "lovingRelationship = false" , very relatable
fr
lol
fr lol
Fellas I did it I finished the challenge and fixed the problems on my own! Im hitting the big league!
The challenge at the end of this video was very fun! Thank you so much. You are a great, fun teacher.
guhhh guuhhh, glazinggggggg
@@sebo_lifts fr tho
Thank you. I study C# with your lessons
you managed to make coding fun with that random fact and boolean type :) you are a great teacher
I made so many mistakes with this short video, it took me 2 days to fix everything 🤦🏼♀but it was all part of my learning process, thank you for these videos, are super usuful and I feel that I am learning a lot
The only way to be good at something is to be bad at something. Mistakes are painful but it's truly the way we learn. Keep up the awesome work!
This has been such an enjoyable course so far. I really enjoy the assignments at the end of each lesson. It's nice to practice without simply following along. It helps me to remember things.
Anyway, I just wanted to say thanks for all your hard work in making this course. It's certainly appreciated and incredibly helpful to beginners like myself.
Another great video! The example was a great way to show the types in action.
At first I thought the numbers weren't going to work because they aren't casted in the statement but it looks like it knows what to do with other types so awesome new find.
thanks for making these videos :) you are a great teacher
So far so good! Still don't understand everything I'm doing, but I understand a bit more with each video.
Great video can't wait for the next one!
Your humor is something else
Thanks sir,please keep going your amazing job,i hope you will make a serie for making games examples later on this channel.
Thank you. You've got my subscription. But I have one I have one suggestion based off an incredibly frustrating problem I encountered. My Visual Studio wasn't giving me code completion options or error messages and it was driving me crazy. I finally found a solution after a couple hours of trying different fixes. And that solution was in your 3rd video. For some reason when I install everthing it didn't set VS as the preference, but would still open it everytime I went to code. Maybe link video three to the first one for people having the same issue. Any thanks this Thank you again. I've only been writing code for about 5 days now and is is much more instructive then the previous tutorial I was fighting to learn.
i did the challenge and was able to make it so i could change them in unity like the hello world tutorial :)
I did the solution on my own and figured I could just use strings for everything since we aren't doing any calculations with the numbers.
I messed up one step and it took two hours to fix it. The euphoria of seeing text pop up on my screen is going to be a bit addicting innit?
thank you so much sir, great tutorial for a beginner like me.. thankss...👍
I'm so glad these are helping. Soon we will get to the part where we actually use this stuff to make a game :)
I just noticed you have a number of similarly named videos from 8 years ago. Are you updating those with this new series? I'm just wondering what you would recommend I go on to when finished #11 on Enumerations?
Great videos and exercises. Well paced, lots of good info practically presented.
i might be late but 16:50 the anotherNoun is supposed to be adjective i think
I will be looking forward watching this series so by the time you are done i can make a game
Thank you🙏❤
Thank youu!! This helped me a LOT!
Great video! It really helps thankyouuu
Thank you!
Thank you!!!
this is a great help, I really enjoy the sort one concept lessons with a task at the end. though in my solution I wrote the bool as [ public bool statement = !(false && true); ] so you could more readily change between true and false within the unity editor and same sorta idea with the int and float by not explicitly setting them to any value [ public int Number; ] [ public float percent; ] and it seems to work great.
when would a private string or whatever be used? why would you want your game to not be able to access a part of the code?
Maybe if your working in a group and you want to make sure the number is never changed by anyone else, or maybe if your game has some sort of command line thing or whatever like Minecraft or the Doom games and you don't want anyone to figure out how to change certain numbers that could allow for cheating or something, idk, developers probably rarely ever use the "const int" type, I've been using Unity for about 4 years and I've never even heard of all of these besides. String, Int, and Float, those are the only 3 I have ever used for numbers
when he also typed "clowns" i squealed
the challenge was fun I got "The statement is False. I did not kill the man. I am not guilty. I am an innocent person. The act was performed by 2 wandering Criminals. I am 100% sure of this " I changed the sentence a bit tho
amazing
Keep cookin king 👑
I actually thought you asked for the challenge to make us write the input in unity and then give them values... So i did just that
Can you say its a challenge completed😅😅
You are a beast! 💪
I did not "eat" the "mustache"
Me: 🤔🤔🤔
great tutorial by the way😊
isnt that first integer the max shotgun ammo glitch in fortnite (im not addicted i just have a good memory)
looked it up, it isnt but the the 2,147,483 part is, its just the hundred ten and one values that are off
When is it necessary to specify public/private when assigning a variable? When I wrote the challenge I didn't type out public before assigning any of the variables but it seemed to work fine in unity.
public = Any other class can access the variable.
private = Only the class the variable is in can access it.
Another common one you'll see is 'protected' which means the variable can be accessed by both the class it's in AND any sub-classes that derive from that class. As a beginner that one will probably go over your head until you become more familiar with class hierarchies, inheritance, etc. though.
@@Chubzdoomer Ok, but when do you need to specify that a variable is private/public rather than just stating the variable without specifying private/public?
@@MrRyanholder Variables that aren't preceded by anything are private. (In other words, the private keyword is completely optional.)
@@Chubzdoomerthank you, I needed to know this.
so i was messing with bool and code completion taught me something, it turns out C# doesn't think dogs can look up.
your humor sense thoo🤣😂
" error CS0029: Cannot implicitly convert type 'string' to 'bool' "
I started laughing my ass off at the Boolean examples
Poor Boolean guy
"The statement is false. I did not kill the dog. I am an innocent person. The act was performed by 25 wandering Cowboys. I am 39.7% sure of this"
Thanks for the lesson
Do you have any idea why my font isn't the same colour as yours?
for all those lazy people (me being one of them) who don't wanna type the entire string for the challenge here it is:
$"The is statement is {statement}. I did not {verb} the {noun}. I am not guilty. I am a {adjective} person. The act was performed by {number} wandering {pluralNoun}. I am {percent}% sure of this.";
Of course it is preferred you write the entire thing but if you want you can copy and past the above.
If you have any issues with this: sometimes the script must be reassigned.
so i successfully filled in the values in the mad lib but i ran the program with my bool saying true instead of false. I tried to change what the code said but failed to make the change i wanted. is there some extra step i missed to fix the mistake?
Me too facing the same
You cheeky little 😂 there's no way you made me type that.
my bool statement is false but when i run the game its shows true
Channel name changed?! I liked the old one "Vegetarian Zombie"
I hear ya - the full title is Learn Create Play with Vegetarian Zombie. I've been getting a ton more learning subs so I wanted clarify what the channel covers. But thanks for the feedback!
6:56 Number Types
Why the new channel name idu?
I'm changing the focus of the channel to be more "game dev" (Unity, Skyrim modding), and less "let's play" although I will still be doing LPs.
the percentage doas not appear in the game
wetClothesKill = true; Haha shit is so funny
All I'm getting are compiler errors, sigh. This would be a whole lot easier if I weren't an idiot. I guess ill just watch the rest of the series without following along.
6:40 LOOOL WTF
Am I the only one who talked about stealing the moon in the challenge?
loved the video but, umm. Strings contain text, not cheese.
Cheese can contain strings...
public bool lovingRelationShip = false; 💀💀
If you're getting an error then this is the fix:
textMeshPro = GetComponent(); // Assign the result of GetComponent to textMeshPro
Best of luck!
« The statement is False. I did not Eat the young man! I am not guilty, I am just a Crazy man! The acted was performed by 12 monkeys and I am 33% sure of it. » 😂
Jenny Jenny
Why do you remember pi by memory??? why???
BTW Wonderful videos, my dream has always been the one to put my creativity at work by making videogames and your course is simple and effective, i only programmed with python and moving to this is really comfy, you are a clear explainer. THX
// on the line:
textMeshPro = $"The is statement is {statement}. i did not {verb} the {noun}. i am not guilty i am a {adjective} persom. The act was performed by {number} wandering {pluralNoun}. i am {percent}% sure of this.";
// i am running into this error in the code: "Cannot implicitly convert type 'string' to 'TMPro.TextMeshProUGUI' [Assembly-CSharp]csharp(CS0029)"
I cant really pin-point the problem, as far as i can tell my code is a duplicate of the test example beyond the varaibles.
public string words = "Thank You VERY MUCH" ;
textMeshPro = GetComponent();
textMeshPro.text = $"{words}";
I think i did every thing correctly :).