If you beginner in programming, you would probably want to practice your skills. When you do, you would see some coding challenges which is not easy to understand.
In this article, I will go through some of those algorithms and explain them.
So, let’s learn our first algorithms:
Note: You can also use lists instead of an array, the process is exactly the same
You will use this algorithm almost every time. It basically, search for the specific element and check if it exists in the array or not.
To understand how this algorithm work let’s have a look at…
Most of the people (including me) who start with Unity are having a problem with learning
Time.deltaTime. To understand how it works, firstly, I will explain its definition. Then I will show a step-by-step example.
Time.deltaTime is the completion time in seconds since the last frame. This helps us to make the game frame-independent. That is, regardless of the fps, the game will be executed at the same speed. Let’s understand what this means:
Suppose, our game runs at 60 fps. …
Game Development is one of the most popular programming fields. When we want to make games and if we are new to programming, of course, we would not want to reinvent the game engine. Instead, we can use the engines which already exist. There are many game engines like Unity, Unreal Engine, Godot Engine, GameMaker and so on. One of the popular engines of these is the Unity Engine.
Unity is a game engine developed by Unity Technologies. …
All of the programming languages which have Object-Oriented Programming (OOP) feature have classes and objects. We can think of a class as the blueprint for creating objects.
To understand them, let’s see the real-world example:
We have an
Animal class, and
Cat object which is the object of the
Animal class. Animal class has some specifications like their color, height, average life expectancy and so on. If we create an object of it with the name of
Cat, then it will have all of those specifications.
Similarly, if we look at the Object-Oriented Programming, we can see that a class…
When I am working with Unity, I have learnt some very useful attributes. For the first time, when I learnt them, I got surprised about how helpful they are. They help us in using the inspector easier, saving your time, and so on. For example, I have learnt the
Header attribute that helps us to organize our variables in the inspector. Imagine, you have lots of variables and do not use
Header, how messy they are going to seem! Fortunately, we have these kinds of stuff in Unity. …
Method Overriding, in Object-Oriented Programming, is a language feature that allows a child class to implement a method that’s is already is in the parent class. Implementation in the subclass overrides the implementation in base class by creating a method that has the same name.
To understand overriding, let’s look at the real-world example:
Let’s say we have an
Animal class and we have three different animals:
Method Overloading (Polymorphism) in C#
In this blog, I am going to explain what is Method Overloading, also known as Polymorphism.
Let’s say we want two different methods with the same name. If we define methods like this, it would give us compiler error:
CS0111: Type “Class_Name” already defines a member called “MyMethod” with the same parameter types
So, this is where Method Overloading would be useful. Basically, Method Overloading means “defining method with the same name in different forms.” They can be overloaded in 3 different ways:
Arrays and lists are the most used data structures in C# programming language. Both of them store data like integer, string, instances of the class, and so on. They seem very similar at first glance, but actually, they have some necessary differences which affect their usages. Depends on the situation we can prefer to arrays than lists or vice versa. In this blog, I am going to explain which one is better based on what we want to do.
Initially, let’s look at the Array’s definition:
An array is the data structure that stores a fixed number of literal values…