Skip to content

Instantly share code, notes, and snippets.

View vietdungdev's full-sized avatar

DungDajHjep vietdungdev

View GitHub Profile
@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 / .write_to_managed_array_from_Burst-compiled_IJob.md
Last active March 24, 2025 14:58
Write to managed arrays from an `IJob` ! A collections of useful utilities when working with `Unity.Jobs`.

👉write to managed array from a Burst-compiled IJob

Highlights:

  • cast T[] to NativeArray<T>
  • schedule jobs that read/write to managed arrays
  • pointer safety assertion that prevent crashes and data corruption

more info in the first comment under the source code

@Alucard-Jay
Alucard-Jay / BasicFPCC.cs
Last active October 21, 2025 15:43
A basic first person character controller for Unity3D
// ------------------------------------------
// BasicFPCC.cs
// a basic first person character controller
// with jump, crouch, run, slide
// 2020-10-04 Alucard Jay Kay
// ------------------------------------------
// source :
// https://forum.unity.com/threads/a-basic-first-person-character-controller-for-prototyping.1169491/
// Brackeys FPS controller base :
@yasirkula
yasirkula / UnitypackageExtractor.cs
Last active April 21, 2025 12:37
Extract a .unitypackage to any directory (even outside the project folder) from within Unity
#define STOP_EXTRACTION_WHEN_WINDOW_CLOSED
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Text;
using System.Threading;
using UnityEditor;
@zcyemi
zcyemi / JsonHelper.cs
Created March 14, 2018 13:51
Json.Net.JsonConverter for Unity Vector struct.
using UnityEngine;
using Newtonsoft.Json;
using System;
public class Vec4Conv : JsonConverter
{
public override bool CanConvert(Type objectType)
{
if (objectType == typeof(Vector4))
@ikriz
ikriz / EnumFlagAttribute.cs
Last active February 24, 2017 10:27 — forked from ChemiKhazi/EnumFlagAttribute.cs
Unity3d property drawer for automatically making enums flags into mask fields in the inspector.
using UnityEngine;
public class EnumFlagAttribute : PropertyAttribute
{
public string enumName;
public EnumFlagAttribute() {}
public EnumFlagAttribute(string name)
{
@Arakade
Arakade / gist:9dd844c2f9c10e97e3d0
Created January 3, 2015 16:54
Call from OnDrawGizmos() to draw text at Unity3D glocal position in Editor
static void drawString(string text, Vector3 worldPos, Color? colour = null) {
UnityEditor.Handles.BeginGUI();
if (colour.HasValue) GUI.color = colour.Value;
var view = UnityEditor.SceneView.currentDrawingSceneView;
Vector3 screenPos = view.camera.WorldToScreenPoint(worldPos);
Vector2 size = GUI.skin.label.CalcSize(new GUIContent(text));
GUI.Label(new Rect(screenPos.x - (size.x / 2), -screenPos.y + view.position.height + 4, size.x, size.y), text);
UnityEditor.Handles.EndGUI();
}
@ChemiKhazi
ChemiKhazi / EnumFlagAttribute.cs
Created April 29, 2014 09:59
Unity3d property drawer for automatically making enums flags into mask fields in the inspector.
using UnityEngine;
public class EnumFlagAttribute : PropertyAttribute
{
public string enumName;
public EnumFlagAttribute() {}
public EnumFlagAttribute(string name)
{