There are two simple methods of writing scripts for the mouse to interact with the game object. A simple method is to write a script for each game object where on mouse down or up, execute some code. …
This is just a simple guide for saving and loading data from PlayerPrefs in Unity.
PlayerPrefs system in Unity allows users to store and access player data between game sessions. It stores data in a plain text file which makes any data easy to access but also easy to hack. Therefore try not to store any important data in PlayerPrefs.
Before starting, note that PlayerPrefs allows users to store 3 different types of data:
First I create an empty game object in Unity and call it GameController, while giving it the tag GameController as well. Then I create a new C# script where I’m going to edit and read data from, called PrefsControl.
You can easily access these functions from any other script, just find the game object first, then find the script and access it from there.
This is my list that I believe is important when creating UI elements in Unity.
Organize using Empty gameObject.
Everything in the Unity UI can be organized inside an empty gameObject. UI elements that is similar should be grouped together under the same gameObject. Not only is this better for organization, it’s also useful…
Recently I created an Unity 2D project, and recently came into issues with my project once I loaded the project to my laptop. My laptop isn’t anywhere as good as my desktop, therefore very often I would run into frame issues where instead of normal 60 frames per second, I…
As a programmer we have seen the Big O notation many times, yet I noticed this is one concept that a lot of beginner programmers have a hard time understanding. It’s not the concept is hard to understand, it basically describe the performance or the complexity of an algorithm. …