Skip to content

Instantly share code, notes, and snippets.

View 5argon's full-sized avatar
🏠
Coffee shop programmer 24h

Sirawat Pitaksarit 5argon

🏠
Coffee shop programmer 24h
View GitHub Profile
@5argon
5argon / OdinBuildSwitcher.cs
Last active May 14, 2018 17:38
A dockable build switcher and defines manager. Edit `Defines` and `AllBuilds` in the code to fit your project.
/// OdinBuildSwitcher
/// 5argon - Exceed7 Experiments
/// http://exceed7.com , 5argon@exceed7.com
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using System.Linq;
@5argon
5argon / ECSContainerSpeedTest.cs
Created June 9, 2018 09:11
Comparing read-write speed of Unity's ECS native container against regular arrays. Read-write linearly.
using UnityEngine;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine.Experimental.PlayerLoop;
using System.Collections.Generic;
using System.Diagnostics;
@5argon
5argon / FilteringSpeed.cs
Last active July 8, 2018 08:39
Unity ECS filter speed SetFilter vs. ForEachFilter printed on the console as CSV (Result : https://gist.github.com/5argon/1bb412d218eb6872418fe2f867a20435)
using System.Collections.Generic;
using NUnit.Framework;
using System.Linq;
using Unity.Entities;
using Unity.Collections;
using System.Diagnostics;
public struct IntData : IComponentData { public int data; public override string ToString() => data.ToString(); }
public struct Category : ISharedComponentData { public int category; }
entitiesPerCategory kindsOfCategory categoryToFilter SetFilter ForEachFilter Faster Faster %
10 5 1 38.89 789.89 SetFilter 1931.14%
10 5 1 40.33 953.33 SetFilter 2263.64%
10 5 3 120.78 993.22 SetFilter 722.36%
10 5 5 198.11 1036.56 SetFilter 423.22%
10 10 1 41.11 878.22 SetFilter 2036.22%
10 10 3 125.44 990.22 SetFilter 689.37%
10 10 5 207.89 1227.67 SetFilter 490.54%
10 10 10 415.89 1342.56 SetFilter 222.82%
10 25 1 46.56 936.78 SetFilter 1912.17%
@5argon
5argon / csharp.json
Created July 11, 2018 20:16
Snippet for working with Unity ECS
{
// Place your snippets for csharp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@5argon
5argon / ServiceAccountJsonToToken.cs
Last active July 26, 2023 07:04
From service account .json file -> JWT -> OAuth2 service account token with pure REST API in Unity
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
internal class ServiceAccountJsonToToken
struct Work : IComponentData
{
public int id; //<-- use to determine whether to mark or tag.
public int value; //<-- work on this.
//public Junks junks;
}
struct Mark : IComponentData
{
public bool marked;
@5argon
5argon / simfile-to-mp3.ts
Created April 1, 2023 08:38
Deno script to turn DDR Simfile folder to metadata tagged MP3
import {
join,
dirname,
resolve,
basename,
} from "https://deno.land/std/path/mod.ts";
import { ensureDir } from "https://deno.land/std/fs/mod.ts";
interface Notes {