Skip to content

Instantly share code, notes, and snippets.

View Bezhok's full-sized avatar
🏠
Working from home

Bezhok Nikita Bezhok

🏠
Working from home
View GitHub Profile
@forestrf
forestrf / Selectable.cs
Last active April 4, 2025 11:34
Improved UI navigation on Selectable.cs
// Improved navigation code
using System;
using System.Collections.Generic;
using UnityEngine.Serialization;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
[AddComponentMenu("UI/Selectable", 35)]
[ExecuteAlways]
@StagPoint
StagPoint / AddAnimationClipsToControllerAsset.cs
Created December 5, 2021 18:50
Unity editor script that adds existing AnimationClip assets to the AnimationController asset that uses them, cutting down on clutter and making it easier to manage your controllers and their associated animation clips.
namespace StagPoint.EditorUtils
{
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Animations;
@drawcode
drawcode / .gpu-instancing.md
Last active July 29, 2024 09:27
Unity GPU Instancing

https://docs.unity3d.com/Manual/GPUInstancing.html

GPU Instancing (Unity)

Introduction

Use GPU Instancing to draw (or render) multiple copies of the same Mesh at once, using a small number of draw calls. It is useful for drawing objects such as buildings, trees and grass, or other things that appear repeatedly in a Scene .

GPU Instancing only renders identical Meshes with each draw call, but each instance can have different parameters (for example, color or scale) to add variation and reduce the appearance of repetition.

@tconkling
tconkling / DynamicTrigger.cs
Last active April 6, 2025 20:49
Utility for managing Unity trigger collision enter/exit events for destroyable triggers
using System.Collections.Generic;
using UnityEngine;
namespace TheHunt.Util {
/// <summary>
/// Extend this abstract base class to receive enter/exit events
/// from dynamic triggers.
/// </summary>
public abstract class DynamicTriggerListener : MonoBehaviour {
@djcsdy
djcsdy / Unity with source control.md
Last active February 7, 2025 22:52
Unity with source control

In the Unity editor:

  1. Edit -> Project Settings -> Editor
  2. In the inspector panel, set:
  3. Version Control -> Mode: Visible Meta Files
  4. Asset Serialization -> Mode: Force Text

“Visible Meta Files” causes Unity to place .meta files next to each of your assets. It’s important to check these files into version control because they contain the settings associated with those assets that you set in the Unity editor.

“Asset Serialization: Force Text” causes Unity to write its .meta and other files in a more-or-less human-readable text format, which makes it a lot easier to understand what has changed when you look at version control logs. Also it’s feasible to merge these text files by hand, whereas it’s not really possible to do that with Unity’s default binary file format.

@nemotoo
nemotoo / .gitattributes
Last active April 23, 2025 10:01
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@daemon3000
daemon3000 / TagsAndLayersTool.cs
Last active January 29, 2025 13:17
A tool for Unity that generates type safe tags and layers
#region [Copyright (c) 2014-2017 Cristian Alexandru Geambasu]
// Distributed under the terms of an MIT-style license:
//
// The MIT License
//
// Copyright (c) 2014-2017 Cristian Alexandru Geambasu([email protected])
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,