Skip to content

Instantly share code, notes, and snippets.

andrew-raphael-lukasik /
Last active May 15, 2024 12:17
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


  • 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

karljj1 / ObjectChangeEventsExample.cs
Last active February 13, 2024 14:01
Example of how to use ObjectChangeEvents in Unity
using System.Text;
using UnityEditor;
using UnityEngine;
public class ObjectChangeEventsExample
static ObjectChangeEventsExample()
ObjectChangeEvents.changesPublished += ChangesPublished;
andrew-raphael-lukasik / Mem.cs
Last active November 29, 2022 23:24
MemCpy between unmanaged and managed arrays
// src*
using UnityEngine;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
// Project Settings/Player/Other Settings/Script Compilation/Allow `Unsafe` Code = ☑
public static class Mem
public static unsafe bool Cpy<SRC, DST>(NativeArray<SRC> src, DST[] dst)
AlexMerzlikin / UniversalRenderPipelineTemplateWithDotsInstancing.shader
Last active May 8, 2024 00:41
Template unlit URP shader that supports DOTS instancing to use as a guide to create shaders for BatchRendererGroup since BRG only works with DOTS instancing compatible shaders. Unfortunately, the official docs about it haven't helped me that much, and I thought others might face the same issues.
Shader "Universal Render Pipeline/Custom/UnlitWithDotsInstancing"
_BaseMap ("Base Texture", 2D) = "white" {}
_BaseColor ("Base Colour", Color) = (1, 1, 1, 1)
scooterpsu / config.ps1
Last active December 30, 2022 04:36
Gotify client for Windows Notifications
$domain = ""
$token = "AAAAAAAA"
$useHeaders = $false
forcepusher / Program.cs
Last active May 14, 2023 13:41
Unity "void Main" OOP template
using System.Diagnostics;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace BananaParty.FurryGame.Client
/// <summary>
/// Entry point for wiring up the engine and executing main loop.
/// </summary>
codebykyle / connect.ps1
Last active May 8, 2024 04:07
Windows Terminal Split Pane Powershell Script - v2
using namespace System.Collections.Generic
# Encapsulate an arbitrary command
class PaneCommand {
PaneCommand() {
$this.Command = "";
dylan2intel /
Last active December 30, 2021 04:31
WSL2 Cisco AnyConnect VPN Client Networking Connection Issue Workaround

How to use the above files?

Step 1: Copy files updateInterfaceMetric.ps1, updateDns.ps1, to your Windows path %HOMEPATH%\WSL2\scripts, if not exists, create this folder.

Step 2: Win+R Run taskschd.msc will open "Task Schedulder" application, import two tasks with files UpdateInterfaceMetric.xml, updateDns.xml one by one.

unitycoder / UnityForumBoardSearchHelper.js
Last active June 15, 2023 16:52
Unity Forum Search : AutoSelect current board item inside Search select list (based on referrer url)
// ==UserScript==
// @name Unity Forum Search : AutoSelect current board item inside Search select list (based on referrer url)
// @namespace
// @version 1
// @include
// @grant none
// ==/UserScript==
// more info
// get referring board url
OscarAbraham / PlainDataInstancer.cs
Last active March 18, 2024 15:58
PlainDataInstancer ScriptableObject for Unity, so you can create deep clones of data stored in SO assets at runtime without the overhead of ScriptableObject copies.
using System.Collections.Generic;
using UnityEngine;
// TData should be a plain class or struct with the [System.Serializable] attribute.
// TData can implement ISerializationCallbackReceiver if needed for more advanced uses.
public class PlainDataInstancer<TData> : ScriptableObject
private static bool s_DataTypeValidated;
[SerializeField] private TData m_PrototypeData;