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 / AssistantsSchemas.cs
Created April 3, 2025 19:12
A C# script file (CSX) implementing the OpenAI API (also works as regular C# code) ...
/* --------------------------------------------------------------------------------
* Notes (AssistantsSchemas.cs) ::
* --------------------------------------------------------------------------------
* This file contains a set of classes and interfaces that define the structure
* of the JSON objects that are used to interact with the OpenAI API. These objects
* are used to serialize and deserialize JSON data to and from C# objects.
* We use System.Text.Json for this purpose, and the classes in this file are
* designed to work with the default JSON serialization options provided by the
* System.Text.Json library (higher performance than Newtonsoft.Json).
*
@atcarter714
atcarter714 / SimulatingUnityNull.cs
Last active May 8, 2025 20:18
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 17, 2025 16:25
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() {