This file contains hidden or 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 static class TransformExtensions | |
| { | |
| static Stack<Transform> moveTargets = new Stack<Transform> (); //This is only used by SetLayerToThisAndChildren | |
| public static void SetLayerToThisAndChildren (this Transform root, int layer) | |
| { |
This file contains hidden or 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.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| [ExecuteInEditMode] | |
| public class TubeTrail : MonoBehaviour | |
| { | |
| public int sections = 16; | |
| public float radius = 0.5f; | |
| public int columns = 8; |
This file contains hidden or 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; | |
| public static class ComponentExtensions | |
| { | |
| static public T GetChildComponent<T> (this Component parent, string path, bool ignoreErrors = false) where T:Component | |
| { | |
| var child = parent.transform.Find (path); | |
| if (child == null) { | |
| if (!ignoreErrors) |
This file contains hidden or 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; | |
| public static class MathUtils | |
| { | |
| public const float TAU = Mathf.PI * 2; | |
| public static float MoveTowards (float current, float goal, float amount) | |
| { | |
| var delta = goal - current; |
This file contains hidden or 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; | |
| [InitializeOnLoad] | |
| public class SuspendCompileInPlayMode | |
| { | |
| #pragma warning disable 0414 | |
| private static SuspendCompileInPlayMode _instance = null; | |
| #pragma warning restore 0414 |
This file contains hidden or 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 "TerrainSplatShader" { | |
| Properties { | |
| _MainTex ("Base (RGBa)", 2D) = "white" {} | |
| _Smoothness1 ("_Smoothness1", Range(0, 1.0)) = 0.3 | |
| _Metallic1 ("_Metallic1", Range(0, 1.0)) = 0.3 | |
| _MainTex2 ("Base2 (RGBq)", 2D) = "white" {} | |
| _Smoothness2 ("_Smoothness2", Range(0, 1.0)) = 0.3 | |
| _Metallic2 ("_Metallic2", Range(0, 1.0)) = 0.3 |
This file contains hidden or 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 UnityEditor; | |
| public class TerrainTexturing : EditorWindow | |
| { | |
| [MenuItem ("Hello/Terrain/Texturing")] | |
| static void OpenEditor () | |
| { | |
| EditorWindow.GetWindow<TerrainTexturing> (); |
This file contains hidden or 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
| /* | |
| Write a graph to a texture | |
| Usage: | |
| void Start(){ | |
| graph = new Graph (512, 256, new Color[]{ Color.red, Color.green, Color.blue }); | |
| graphRenderer.material.mainTexture = graph.texture; | |
| } | |
| void Update(){ |
This file contains hidden or 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 Pool : MonoBehaviour | |
| { | |
| static Pool instance; | |
| static public Pool Instance | |
| { |
This file contains hidden or 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 System.Collections.Generic; | |
| using UnityEngine; | |
| public class CameraListEditor : EditorWindow | |
| { | |
| private List<Camera> cameras = new List<Camera>(); | |
| [MenuItem("Hello/Scene/Camera List")] | |
| public static void Init() |