You've successfully subscribed to Hacking with Unity - Learn how to create your own games
Great! Next, complete checkout for full access to Hacking with Unity - Learn how to create your own games
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

How to prevent colliders from passing through each other
Members Public

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 works well for bullets or small objects, but won't produce good results for large objects. void FixedUpdate() { Vector3 direction = new

Ben Liu
Ben Liu
Unity Tips

Mouse Click or Finger tap only on eiher game objects or UI objects
Members Public

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 void MouseInput() { if (Input.GetButtonDown("Fire1")) { if (!EventSystem.current.IsPointerOverGameObject()) { Debug.Log(Input.mousePosition); Vector3 pz = Camera.main.ScreenToWorldPoint(Input.

Ben Liu
Ben Liu
Unity Tips

Unity Mesh Introduction
Members Public

What is MeshMesh 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, and a complex polygon is actually made up of multiple triangular faces. So the surface of a 3D model is composed

Ben Liu
Ben Liu
Unity Tips

Walk Through Monobehaviour
Members Public

MonobehaviourLike 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 is the introduction of the Monobehaviour. MonoBehaviour LifecycleMonoBehaviour is the base class of all scripts in Unity. If you use

Ben Liu
Ben Liu
Unity Basic

Coordinate system in Unity
Members Public

Unity uses several different coordinate systems at the same time, as follows: Screen SpaceAlso named Screen point system. The screen coordinates are defined in pixels. The lower left corner of the screen is the start (0, 0) point, and the upper right corner is the (Screen.width, Screen.height) point.

Ben Liu
Ben Liu
Unity Tips

Date time in C#
Members Public

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 DateTime currentDateTime= DateTime.Now; Console.WriteLine(currentDateTime.ToString()); Get date and time difference between two dates// Get time difference between

Ben Liu
Ben Liu
C#

Unity plugs Genshin Impact used
Members Public

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 effects? It is known that Genshin Impact  is developed based on the Unity engine, and Unity has powerful plugin systems.

Ben Liu
Ben Liu
Unity Tips

Ternary Operator in C#
Members Public

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 life insurance" : "Player is young"; } }

Ben Liu
Ben Liu
C#