Hacking with Unity - Learn how to create your own games
  • Unity Basics
  • C#
  • Free Resources
Log in Subscribe
Log in Subscribe
  • Unity Basics
  • C#
  • Free Resources
Methods in MonoBehaviour and execution order C#

Methods in MonoBehaviour and execution order

In Unity, MonoBehaviour is a class that you can use to extend the functionality of a game object. When you attach a script derived from MonoBehaviour to a game object,

  • Go to the profile of  HackingWithUnity
HackingWithUnity
20 Feb 2023 · 2 min read
Import 2D Sprites in Unity Unity Basic

Import 2D Sprites in Unity

Suppose we have a bunch of 2D resources, such as idle, run, and so on, and we want to import that in our 2D game with animation, here are few

  • Go to the profile of  HackingWithUnity
HackingWithUnity
19 Feb 2023 · 2 min read
GameManager Template in Unity Unity Tips

GameManager Template in Unity

Many game developer are using GameManager to manage the game status, do initialization and more in their games. So it is recommend for anyone who wants to have the same

  • Go to the profile of  HackingWithUnity
HackingWithUnity
18 Feb 2023 · 1 min read
[System.Serializable] in Unity Unity Basic

[System.Serializable] in Unity

[System.Serializable] is a C# attribute that can be applied to a class, struct, or field to indicate that it can be serialized by Unity's serialization system. By doing which

  • Go to the profile of  HackingWithUnity
HackingWithUnity
17 Feb 2023 · 1 min read
How to refer child game objects' instance in Unity Unity Tips

How to refer child game objects' instance in Unity

Image you have a grouped objects in the hierarchy, Game object 1 has child game objects 1_0, 1_1 and 1_2 as following: So how do we get

  • Go to the profile of  HackingWithUnity
HackingWithUnity
16 Feb 2023 · 1 min read
Turn JSON string into Custom objects in Unity Unity Basic

Turn JSON string into Custom objects in Unity

Store user's data or game's state in JSON, or fetch data from api call in game, Luckily, Unity does provide the JsonUtility to rescue, which can easily convert a json

  • Go to the profile of  HackingWithUnity
HackingWithUnity
16 Feb 2023 · 1 min read
Check user's IP address in Unity Unity Basic

Check user's IP address in Unity

Although Unity does not provide a way on checking user's ip directly, still we can make a script to achieve that: using System.Collections; using System.Collections.Generic; using UnityEngine;

  • Go to the profile of  HackingWithUnity
HackingWithUnity
15 Feb 2023 · 1 min read
What is the difference between GameObject.FindObjectOfType and GetComponent Unity Basic

What is the difference between GameObject.FindObjectOfType and GetComponent

In Unity, it is quite often to get a GameObject's component, such RigidBody or collision2D. There are a couple of ways of doing so, and GameObject.FindObjectOfType<>() ,GetComponent<>() are both

  • Go to the profile of  HackingWithUnity
HackingWithUnity
14 Feb 2023 · 1 min read
Canvas Render Mode in Unity Unity Basic

Canvas Render Mode in Unity

Canvas is a key component of UI in Unity and Canvas render mode is the key of showing the canvas properly. There are 3 render modes at the moment in

  • Go to the profile of  HackingWithUnity
HackingWithUnity
13 Feb 2023 · 2 min read
PlayerPrefs in Unity and how to use it C#

PlayerPrefs in Unity and how to use it

PlayerPrefs is a built-in class in Unity that provides an easy and native way to store and retrieve values. It can be used to save data such as user preferences,

  • Go to the profile of  HackingWithUnity
HackingWithUnity
11 Feb 2023 · 1 min read
3 ways to check whether an element is in array in C# C#

3 ways to check whether an element is in array in C#

In C#, we can check if an element is in an array by using the System.Array class and its IndexOf method. Here's an example: string[] stringArray = { "text1", "text2", "text3"

  • Go to the profile of  HackingWithUnity
HackingWithUnity
10 Feb 2023 · 1 min read
Unity Tips

How to prevent colliders from passing through each other

Collisions with fast-moving objects are always a problem. A good way to ensure that you detect all collisions is to use Raycasting instead of relying on a physics simulation. This

  • Go to the profile of  HackingWithUnity
HackingWithUnity
22 Mar 2021 · 1 min read
© 2023 Hacking with Unity - Learn how to create your own games. All rights reserved.
  • Private Policy
  • Cookie Policy