Refactor Code with OOP(3) : Encapsulation
The written content was created by referencing materials from the Unity Learn website. What is Encapsulation? A major theme of encapsulation is safety in code - in other words, the process of en...
The written content was created by referencing materials from the Unity Learn website. What is Encapsulation? A major theme of encapsulation is safety in code - in other words, the process of en...
The written content was created by referencing materials from the Unity Learn website. Relationship between Inheritance and Polymorphism Inheritance and polymorphism are deeply intertwined. Inhe...
Abstraction and script refactoring Refactoring is a process to work through existing code and improve it without changing its external functionality. Refactoring is an inportant step in the devel...
The written content was created by referencing materials from the Unity Learn website. Go To Previous Post In this post, we’re going to write the color selected by the user to a file. Then, we’re...
The written content was created by referencing materials from the Unity Learn website. What is data persistence? Data persistence means making data last longer than the process used to creat...
The written content was created by referencing materials from the Unity Learn website. Object-oriented programming(OOP), is a programming pattern in which the methods and variables are related t...
Go To Previous Post Aug 7, 2024 1) Remove a Heart When the Player Catches a Leftover Fish The first step was positioning the three heart assets in the scene. I then created a new GameObject nam...
Hey everyone! Wow, it’s been two months since I started learning Unity. Time flies, doesn’t it? I had a great opportunity to work on a small Unity project through learn.unity.com. Previously, I t...
Variable Attributes [SerializeField] Until now I’ve only ever used ‘public’ or ‘private’ variables. But you know, there are a lot of other variable attributes that we should be familiar with. ...
0. The difficulty buttons look messy Center the text on the buttons horizontally and vertically 1. The food is being destroyed too soon The food should only be destroyed when the player...
0. Fix error before we start challenge Original EnemyX.cs void Update() { enemyRb = GetComponent<Rigidbody>(); } Modified EnemyX. cs void Update() { enemyRb = GetComponent&l...
How to make enemy follow the player I created a new game object, Enemy. And I wanted to make it that can actually chase the Player around the Scene. So the first thing I did, of course created a...
Long time no see everyone LOL How to create a focal point for the camera Okay, So for this game, my entire platform is the center point of my entire Player view. So I used the camera to be able...
How to open Animator Window After you click on the Player, apply an Animator Component in your Inspector. Attach your file for Controller and Avatar and double-click on that Controller box. ...
I need to repeat the background and move it left at the same speed as the obstacles, to make it look like the world is rushing by! How to reset position of background? Let’s creat a new script ...
How to make player jump at start? If you want to actually control the movement and the Gravity of the player, and all of that, you actually need to use a new way to get a Component for your “Rigi...
How to spawn random objects? First, we need to create empty GameObject into our project hierarchy. this is what we’ll be using to manage all of the spawning of all of objects on the screen. And...
How to keep the player inbounds We’re going to set a boundary so that the player cannot leave this area. In my game, the player is moving left or right on their X position. So I’m going to get...
How to allow the object to move left/right If you open your Script, we’re going to need a way to control the object to move left or right, so we should probably just use a variable to do that. ...
How to give the object a forward motion Okay, Let’s move the blue arrow in the scene. If you look in the Inspector on the right side, in our “Transform” Component, we can see that the Z is upda...