Skip to content

Instantly share code, notes, and snippets.

View CSaratakij's full-sized avatar
🎯
Focusing

Chatchai Saratakij CSaratakij

🎯
Focusing
View GitHub Profile
@CSaratakij
CSaratakij / SkinnedMeshUpdater.cs
Created September 22, 2023 08:42 — forked from tsubaki/SkinnedMeshUpdater.cs
update SkinnedMesh
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Assertions;
using System;
public class SkinnedMeshUpdater : MonoBehaviour
{
[SerializeField]
SkinnedMeshRenderer original;
@CSaratakij
CSaratakij / unityPlayer.cs
Created June 20, 2023 10:09 — forked from Oleur/unityPlayer.cs
Get current Android activity and init an Android object from Unity
AndroidJavaObject localMediaPlayer = null;
using (AndroidJavaClass javaUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
using (currentActivity = javaUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
{
localMediaPlayer = new AndroidJavaObject("my/plugin/vr/ExoPlayerBridge", currentActivity);
if (localMediaPlayer != null)
{
@CSaratakij
CSaratakij / remover.py
Last active February 28, 2023 22:35
Json comment remover '//'
#!/usr/bin/env python3
import argparse
from pathlib import Path
commentSymbol = "//"
parser = argparse.ArgumentParser(description="Remove comment from json.")
parser.add_argument("input", help="input file path")
parser.add_argument("output", help="output file path")
@CSaratakij
CSaratakij / AssetImportLogger.cs
Created March 28, 2022 07:14
Asset Import Logger (for re-import issue)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class AssetImportLogger : AssetPostprocessor
{
public const string IS_ENABLE_KEY = "KEY_ASSET_IMPORT_LOGGER_IS_ENABLE";
public const string IS_START_KEY = "KEY_ASSET_IMPORT_LOGGER_IS_START";
public const string LOG_FORMAT = "path '{0}'";
@CSaratakij
CSaratakij / introrx.md
Created October 1, 2020 04:51 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@CSaratakij
CSaratakij / README.txt
Last active April 4, 2024 20:57
Video Wallpaper (hw-accelerate) : Use 'mpv' as a video player backend with 'xwinwrap' to wrap our window to be use as a desktop background
You want to use a live wallpaper in x11?
Great!!...but It come as a cost.
I did experiment with .gif backend and non hardware accelerate backend, It sucks.
CPU usage was so high (40% up just for idle), unacceptable for my laptop.
Running with those backend for such a really long time will slowly turn your laptop into the hot potato.
But don't be upset, we can reduce those cost.
Using the video player with hardware video decoding support can reduce the cost.
using UnityEngine;
public class Example : MonoBehavoiur
{
[SerializeField]
GameObject prefab;
bool isTrigger = false;
void OnTriggerEnter(Collider col)
@CSaratakij
CSaratakij / utils.cs
Created February 27, 2020 10:47
Shuffle sample (Generic)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Utils : MonoBehaviour
{
int[] numbers = new int[] {
1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0
};
@CSaratakij
CSaratakij / TriggerContainerEditor.cs
Last active May 18, 2019 09:21 — forked from bzgeb/TriggerContainerEditor.cs
Example Drag & Drop area in a custom inspector for the Unity editor
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor (typeof(TriggerContainer))]
public class TriggerContainerEditor : Editor
{
private SerializedObject obj;
@CSaratakij
CSaratakij / PDF_To_JPG
Last active April 10, 2019 05:36
Nautilus convert .pdf to .jpg script intregation (multiple select files support)
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
COUNTER=0
echo -e "Start converting files..."
notify-send "Start converting files..."
for path in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do