Skip to content

Instantly share code, notes, and snippets.

View atcarter714's full-sized avatar
⛈️
Head in the cloud ...

Aaron Carter atcarter714

⛈️
Head in the cloud ...
View GitHub Profile
@atcarter714
atcarter714 / SimulatingUnityNull.cs
Last active September 7, 2023 22:01
Clearing up the confusion about how null-ness of Unity Objects works with a very simple simulation of it!
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Here we simulate a managed object using native memory resources which has the same
// behavior as a Unity Object with "null-ness" and checks. It demonstrates why if(obj)
// is usually how you should be doing your checks ...
internal class Program
{
private static void Main( string[] args )
@MrJul
MrJul / TextureAlphaPremultiplier.cs
Last active May 18, 2023 03:07
Pre-multiply alpha channel when importing Unity textures
using System;
using JetBrains.Annotations;
using UnityEditor;
using UnityEngine;
namespace UnityProject.Editor {
public sealed class TextureAlphaPremultiplier : AssetPostprocessor {
public void OnPreprocessTexture() {