In this guide I just want to quickly go over a simple way to switch between cameras in Unity. We can achieve this by setting different cameras on or off using SetActive().

We first start by deciding on the condition we use to change the camera. For now we’ll use…

Unity have a lot of special event functions that gets called automatically by the engine. For example Start and Update function is added to every script by default.

In this post I want to talk about the difference between two similar functions that can easily be mixed up with each…

In unity there are two basic method of moving an object. Using translate on the object itself, or using a rigidbody.

Translate

Moving with translate is easy. All you need is to grab the transform (object) and apply a translate which includes a vector 2 for direction, then speed and time.

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:

  • SetFloat()
  • SetInt()
  • SetString()

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. …

There is a feature that was being experimented on in ruby which is the “Right-ward Assignment Operator”.

By current day standard, we assign values to variable using a “left”-ward assignment operator. Where the variable is on the left, and the value is on the right.

variableName = variableValue

This new…

Fanzhong Zeng

Just a student at flatiron

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store