Skip to content

Instantly share code, notes, and snippets.

View boxibi24's full-sized avatar

Tu Nguyen boxibi24

View GitHub Profile
@andrew-raphael-lukasik
andrew-raphael-lukasik / MinimumFsmBasedAiController.cs
Last active July 14, 2025 16:29
Goal: to write the most simple yet most useful FSM that convinces Unity devs who still use bool fields to keep track of ai states to change their misguided ways for the better.
using UnityEngine;
public class MinimumFsmBasedAiController : MonoBehaviour
{
public enum EState : byte
{
START = 0,
PATROL,
INVESTIGATE,
ATTACK,
@andrew-raphael-lukasik
andrew-raphael-lukasik / .billboard-shadow.shadergraph.md
Last active August 2, 2025 14:31
Shader Graph files to create billboard trees with billboard shadows. Exported from Unity 2023.2 and Shader Graph 16.0.4

Shader Graph files to create billboard trees with billboard shadows. Exported from Unity 2023.2 and Shader Graph 16.0.4

GIF 17 11 2023 14-38-35

Note: Shaders written for default Quad meshes in mind.

To make sure shadows are being drawn always behind tree billboards change shadow material’s Sorting Priority to a negative value:

Screenshot 2023-11-17 145239

@andrew-raphael-lukasik
andrew-raphael-lukasik / .ObjFileFormatVertexColorImporter.cs.md
Last active August 12, 2025 08:02
OBJ file format vertex color importer for Unity

(Unity) vertex color importer for MeshLab's OBJ files

Update note:

This toy code worked fine in the older Unity version but stopped working correctly in the newer ones. Something about the vertex data order. I suggest using different format - FBX for example.