Skip to content

Instantly share code, notes, and snippets.

@corey-martin
corey-martin / L10N.cs
Last active June 27, 2021 23:58
Super Simple Localization for Unity
using System.Collections.Generic;
using UnityEngine;
using System;
public class L10N
{
[Serializable]
public class Language {
public string name;
public List<string> entries = new List<string>();
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using UnityEngine;
public class SaveData {
public static string version = "2019.11.29";
public static int gameNumber = 1;
static bool initialized = false;
@corey-martin
corey-martin / readme.txt
Created October 6, 2019 20:21
I Have No Mouth And I Must Create Blocks On All Sides Of Me (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@corey-martin
corey-martin / readme.txt
Created October 6, 2019 20:19
I Have No Mouth And I Must Create Blocks On All Sides Of Me (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@corey-martin
corey-martin / readme.txt
Created October 6, 2019 20:10
I Have No Mouth And I Must Create Blocks On All Sides Of Me (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@corey-martin
corey-martin / readme.txt
Created October 6, 2019 10:59
Something from Nothing (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@corey-martin
corey-martin / readme.txt
Created October 6, 2019 10:23
Something from Nothing (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@corey-martin
corey-martin / readme.txt
Created October 6, 2019 03:45
Something from Nothing (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@corey-martin
corey-martin / ComponentDestroyer.cs
Created August 2, 2018 21:31
Dangerous function for making sure a given component isn't attached to the game object (Unity)
void OnValidate() {
AudioSource audio = GetComponent<AudioSource>();
if (audio != null) {
UnityEditor.EditorApplication.delayCall+=()=> {
DestroyImmediate(audio, true);
};
}
}
@corey-martin
corey-martin / MusicManager.cs
Last active November 4, 2016 16:57
Basic Song Shuffler for Unity
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent (typeof (AudioSource))]
public class MusicManager : MonoBehaviour {
// add this script to an empty GameObject
// adjust array size (aka your amount of songs) in the inspector and select or drag & drop your songs