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

HackingWithUnity

Hi I'm HackingWithUnity
93 posts
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
Unity Tips

Mouse Click or Finger tap only on either game objects or UI objects

When facing the situation that we want the mouse click and finger tap can happened only on either game objects or UI items. Here is how: using UnityEngine.EventSystems; private

  • Go to the profile of  HackingWithUnity
HackingWithUnity
15 Mar 2021 · 1 min read
Unity Tips

Unity Mesh Introduction

What is Mesh Mesh is a component in Unity, called mesh component. Simply put, Mesh refers to the mesh of the model. The 3D model is made up of polygons,

  • Go to the profile of  HackingWithUnity
HackingWithUnity
10 Mar 2021 · 2 min read
Unity Basic

Walk Through Monobehaviour

Like other fundamental parts such as GameObject, Compoent, Time, Input and Physics, Monobehaviour is an essential member for writing the script, which is the soul of an GameObject. This article

  • Go to the profile of  HackingWithUnity
HackingWithUnity
8 Mar 2021 · 1 min read
Unity Tips

Coordinate system in Unity

Unity uses several different coordinate systems at the same time, as follows: Screen Space Also named Screen point system. The screen coordinates are defined in pixels. The lower left corner

  • Go to the profile of  HackingWithUnity
HackingWithUnity
6 Mar 2021 · 2 min read
C#

Date time in C#

It is quite common to see Date and Time used in the game, here are some frequently used methods: Get the current date time // Get the current date and time

  • Go to the profile of  HackingWithUnity
HackingWithUnity
4 Mar 2021 · 1 min read
Unity Tips

Unity plugs Genshin Impact used

Genshin Impact is an open-world action role-playing game developed and published by miHoYo, gained millions of users since it was launched. But how does it to achieve its amazing visual

  • Go to the profile of  HackingWithUnity
HackingWithUnity
25 Feb 2021 · 2 min read
C#

Ternary Operator in C#

Also called One-line if: Syntax condition ? consequent : alternative Example using UnityEngine; using System.Collections; public class TernaryOperator: MonoBehaviour { void Start() { int age = 20; string message; message = health > 20 ? "should buy

  • Go to the profile of  HackingWithUnity
HackingWithUnity
23 Feb 2021 · 1 min read
Unity Tips

Copy and paste component properties

It is quite common to adjust value while developing a game, and sometimes we need to put down those values while game is running. There are two ways of doing

  • Go to the profile of  HackingWithUnity
HackingWithUnity
22 Feb 2021 · 1 min read
C#

Namespaces in C#

Namespaces are like containers for classes, which can help us organize the code, we see the same concept in other programming languages such as Java, Python and other languages. The

  • Go to the profile of  HackingWithUnity
HackingWithUnity
19 Feb 2021 · 1 min read
C#

Properties in C#

Like many other programming languages, C# class does have the class properties, also called fields. Example of the class property public class Player { private int experience; public int Experience { get

  • Go to the profile of  HackingWithUnity
HackingWithUnity
19 Feb 2021 · 1 min read
Use Singleton in Unity C#

Use Singleton in Unity

Singleton is a common design pattern in programming, which keeps only one copy of a variable or object throughout the entire runtime of the program. Create a Singleton is quite

  • Go to the profile of  HackingWithUnity
HackingWithUnity
18 Feb 2021 · 1 min read
Unity Basic

Get game object active status in script

It is quite often important to know whether a game object is active or not. bool menuStatus = gameobject.activeSelf; gameObject is the game object in the hierarchy. We can use

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