Skip to content

Instantly share code, notes, and snippets.

View andrew-raphael-lukasik's full-sized avatar
🏴‍☠️

Andrew Raphael Lukasik andrew-raphael-lukasik

🏴‍☠️
View GitHub Profile
@andrew-raphael-lukasik
andrew-raphael-lukasik / IncreaseBuildNumberAutomatically.cs
Last active April 9, 2022 07:34
Increase Build Number Automatically (Unity3d 2017.1.*)
//SOURCE: https://gist.github.com/andrew-raphael-lukasik/36a30f0955d7cdc758e394dc4e7266bf
using System.Collections;
using UnityEngine;
using UnityEditor;
using UnityEditor.Build;
public class IncreaseBuildNumberAutomatically : IPreprocessBuild
@andrew-raphael-lukasik
andrew-raphael-lukasik / RequireReference.cs
Last active July 9, 2018 16:07
Mark your fields with [RequireReference] attribute to make them glow red if null
//SOURCE: https://gist.github.com/andrew-raphael-lukasik/60e6dc072dc170ab535a7aff961c3ba9
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
//TODO: Add build-time warnings
@andrew-raphael-lukasik
andrew-raphael-lukasik / Wait.cs
Last active December 28, 2022 23:32
WaitForSeconds cached means less memory allocations because of coroutines
//Usage example:
//yield return Wait.t2s5;//waits 2.5 seconds
using UnityEngine;
public class Wait
{
public readonly static object frame = null;
public readonly static WaitForEndOfFrame endOfFrame = new WaitForEndOfFrame();
public readonly static WaitForFixedUpdate fixedUpdate = new WaitForFixedUpdate();
@andrew-raphael-lukasik
andrew-raphael-lukasik / Fix Terrain Seams.md
Last active December 28, 2022 23:30
UnityEngine, Fix Terrain Seams
// src*: https://gist.github.com/andrew-raphael-lukasik/d2903247b3f9c94e6faa9c042d9f0460/

#if UNITY_EDITOR
[UnityEditor.MenuItem( "Tools/Fix All Terrain Seams" )]
static void FixAllSeams () { FixTerrains( Object.FindObjectsOfType<Terrain>() ); }
#endif

static void FixTerrains ( Terrain[] terrains )
using System;
using System.IO;
namespace SevenZip.Compression.LZMA
{
public static class SevenZipHelper
{
static int dictionary = 1 << 23;
using UnityEngine;
using Unity.Collections;
using Unity.Mathematics;
public class DynamicMeshData : System.IDisposable
{
#region FIELDS & PROPERTIES
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CoroutineController : MonoBehaviour
{
static CoroutineController _singleton;
static Dictionary<string,IEnumerator> _routines = new Dictionary<string,IEnumerator>(100);
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.BeforeSceneLoad )]
@andrew-raphael-lukasik
andrew-raphael-lukasik / MeshTrianglesToEdges.cs
Created September 19, 2020 21:44
creates array of edges from array of mesh triangles
int2[] ToEdges ( int[] triangles )
{
var edges = new Dictionary<ulong,int2>();
for( int i=0 ; i<triangles.Length ; i+=3 )
{
int a = triangles[i];
int b = triangles[i+1];
int c = triangles[i+2];
ulong hash;
@andrew-raphael-lukasik
andrew-raphael-lukasik / .UIDocumentLocalization.cs.md
Last active March 31, 2024 08:22
Text localization script for UIDocument (UI Toolkit @ Unity)

pattern to follow

// NOTE: this class assumes that you designate StringTable keys in label fields (as seen in Label, Button, etc) // and start them all with '#' char (so other labels will be left be)

@andrew-raphael-lukasik
andrew-raphael-lukasik / LocaleList.cs
Last active August 11, 2023 16:18
Language selection menu (for UIToolkit @ Unity)
// void* src = https://gist.github.com/andrew-raphael-lukasik/e4ae9b45a2c24672c0d1218f77235948
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.ResourceManagement.AsyncOperations;