+ 4
I don't do C# nor do I use unity so i will be using general language. in simple terms, classes help you create pre-defined, similar objects on the fly, with their own properties and behavior(s). Without classes, you'll either have too many variables that are hard to keep track of or you'll have to have some kind of vector table that uses data from somewhere in memory (your object) and performs a specific set of instructions based on that data (That's how it was done in the lower level) for example: int dog1X = 0; int dog1Y = 3; int dog2X = 3; int dog2Y = 7; ... int dog17Y = 34; void walkDog1() { dog1X += 1; } void walkDog2() { dog2X += 3; } ... It gets messy really fast. Also you're only limited to how many dogs you predefined; in this case 17. Maybe you'll need more (poor user experience with few dogs), or maybe less (wasting resources with too many variables). With classes you can dynamically create and destroy dog objects which help in user experience and resource management, which [continued]
6th Jul 2024, 8:13 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
+ 2
are important in game development. There are many ways classes can be, and should be used, which is a huge debatable topic in itself. I recommend starting small and understand the importance of objects before getting into the harder topics. Could just be simple console programs.
6th Jul 2024, 8:15 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar