This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SimpleSoundManager:MonoBehaviour { | |
// Audio source | |
private AudioSource musicSrc; | |
private AudioSource effectSrc; | |
// Instance variable | |
private static SimpleSoundManager instance; | |
// Instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class MeshCut | |
{ | |
private static Plane blade; | |
private static Transform victim_transform; | |
private static Mesh victim_mesh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// This provides a library for stubbing and mocking C++ code as is. It works by requiring | |
// explicit hooks to be inserted into the code that is to be mocked. In a regular build, | |
// these hooks will do nothing. In a testing build, they will expand to calls into the | |
// framework here to allow the code being executed to be hijacked from outside. | |
// | |
// NOTE: Thread-safety! Arranging fakes must be done on a single thread. Using fakes can | |
// be done from multiple threads concurrently. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//originally adopted from | |
//http://answers.unity3d.com/questions/447701/event-for-unity-editor-pause-and-playstop-events.html | |
//with a few modifications which makes the event firing nicer and cleaner | |
//Usage Example : | |
// | |
//using UnityEditor; | |
//using UnityEngine; | |
// | |
//[InitializeOnLoad] | |
//public class SingleEntryPoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
public class Force2DSound:AssetPostprocessor { | |
public void OnPreprocessAudio() { | |
AudioImporter ai = assetImporter as AudioImporter; | |
ai.threeD = false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DebugUtil | |
{ | |
public static void DumpRenderTexture(RenderTexture rt, string pngOutPath) | |
{ | |
var oldRT = RenderTexture.active; | |
var tex = new Texture2D(rt.width, rt.height); | |
RenderTexture.active = rt; | |
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
namespace PvpGame | |
{ | |
public class GridValue | |
{ | |
public enum EntityType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class FindReferences : EditorWindow, ISerializationCallbackReceiver | |
{ | |
List<string> displayedRefs = new List<string>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drop into Assets/Editor, use "Tools/Regenerate asset GUIDs" | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using UnityEditor; | |
namespace UnityGuidRegenerator { | |
public class UnityGuidRegeneratorMenu { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Sprites/Cutout" | |
{ | |
Properties | |
{ | |
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
_Color ("Tint", Color) = (1,1,1,1) | |
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 | |
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.5 | |
} |