Skip to content

Instantly share code, notes, and snippets.

View CSaratakij's full-sized avatar

Chatchai Saratakij CSaratakij

View GitHub Profile
CSaratakij / Health
Last active August 29, 2015 14:12
HealthController(Author: Chatchai Saratakij)
using UnityEngine;
using System.Collections;
public sealed class Health : MonoBehaviour {
int health;
int maxHealth;
CSaratakij / Timer.cs
Last active September 9, 2015 16:54
Unity Timer Example (Author : Chatchai Saratakij (Ton))
using UnityEngine;
using System.Collections;
public sealed class Timer : MonoBehaviour {
[Range(0, 600)]
[Tooltip("Time in seconds. (Time between 0 seconds to 10 minutes.)")]
int time;
CSaratakij / AutoSnap.cs
Created October 10, 2015 05:11 — forked from estebanpadilla/AutoSnap.cs
Auto snap to grid in Unity If you need to auto snap a gameObject to the grid in unity this script will help you. Usage: Create a Editor folder in your assets folder. Add the AutoSnap.cs script to the Editor folder. To open press Command + L (Mal), Control + L (PC) Source:…
using UnityEngine;
using UnityEditor;
public class AutoSnap : EditorWindow
private Vector3 prevPosition;
private bool doSnap = true;
private float snapValue = 1;
[MenuItem( "Edit/Auto Snap %_l" )]
Windows Registry Editor Version 5.00
"MUIVerb"="Open as Unity Project"
@="cmd /c start /D\"c:\\Program Files\\Unity\\Editor\\\" Unity.exe -projectPath \"%1\""
CSaratakij / CameraAnchor.cs
Created November 4, 2015 20:26 — forked from fadookie/CameraAnchor.cs
Screen-relative anchoring component for Unity3D
* This script will anchor a GameObject to a relative screen position.
* This script is intended to be used with CameraFit.cs by Marcel Căşvan, available here:
* Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts.
* You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader.
/* The MIT License (MIT)
Copyright (c) 2015, Eliot Lash
CSaratakij / gist:cd148cb82799619f70cb
Created February 24, 2016 13:52 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1


Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

CSaratakij / calStation.c
Last active February 26, 2016 11:48
ตัวอย่าง program ที่ run ได้ -> original ref :
int main()
char menu;
int recieved, change, stationPrice;
package playground.application
import javafx.application.Application
import javafx.scene.Scene
import javafx.stage.Stage
import javafx.scene.paint.Color
import javafx.scene.text.*
import javafx.scene.control.*
import javafx.scene.layout.*
import javafx.geometry.*
CSaratakij /
Last active March 21, 2016 03:17
My Num Flag Example
package exnumloopflag;
public class ExNumLoopFlag {
public static void main(String[] args) {
int maxNum = 6;
String space = "";
for (int i = maxNum; i > 0; i--) {
package exnumloopflagver2;
public class ExNumLoopFlagVer2 {
public static void main(String[] args) {
int maxNum = 6;
int dragNum = 1;
for (int i = maxNum; i > 0; i--) {