Skip to content

Instantly share code, notes, and snippets.

🏠
Coffee shop programmer 24h

Sirawat Pitaksarit 5argon

🏠
Coffee shop programmer 24h
Block or report user

Report or block 5argon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View TagVsMark.cs
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 / ServiceAccountJsonToToken.cs
Last active Jan 26, 2019
From service account .json file -> JWT -> OAuth2 service account token with pure REST API in Unity
View ServiceAccountJsonToToken.cs
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
@5argon
5argon / csharp.json
Created Jul 11, 2018
Snippet for working with Unity ECS
View csharp.json
{
// 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');",
View FilteringSpeedResult.csv
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 / FilteringSpeed.cs
Last active Jul 8, 2018
Unity ECS filter speed SetFilter vs. ForEachFilter printed on the console as CSV (Result : https://gist.github.com/5argon/1bb412d218eb6872418fe2f867a20435)
View FilteringSpeed.cs
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; }
@5argon
5argon / ECSContainerSpeedTest.cs
Created Jun 9, 2018
Comparing read-write speed of Unity's ECS native container against regular arrays. Read-write linearly.
View ECSContainerSpeedTest.cs
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 / OdinBuildSwitcher.cs
Last active May 14, 2018
A dockable build switcher and defines manager. Edit `Defines` and `AllBuilds` in the code to fit your project.
View OdinBuildSwitcher.cs
/// 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 / GoogleSpreadsheetUnity.cs
Created May 2, 2018
How to get Google Spreadsheet data to Unity. Put Google Api + Auth + Sheets .dll into your project. Then put .p12 service account file somewhere in Assets.
View GoogleSpreadsheetUnity.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data;
using Google.Apis.Services;
@5argon
5argon / LerpTest.cs
Created Nov 16, 2017
You can use ref and your own Lerp function to beat the performance of Vector3.LerpUnclamped (Vector3.Lerp is slower than Unclamped ones)
View LerpTest.cs
using UnityEngine;
using UnityEditor;
using NUnit.Framework;
using System.Collections.Generic;
using System.Diagnostics;
public class TestMisc {
delegate Vector3 CustomLerp(Vector3 v1, Vector3 v2, float lerp);
delegate void CustomLerpRef(ref Vector3 v1, Vector3 v2, float lerp);
@5argon
5argon / FirebaseUnityStudy.cs
Created Aug 7, 2017
Study the behavior of Unity Firebase API. Run this one by one so it exits play mode in between tests, clearing everything out as much as possible.
View FirebaseUnityStudy.cs
#if UNITY_EDITOR
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;
using System.Collections.Generic;
using NUnit.Framework;
using Firebase;
You can’t perform that action at this time.