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
| foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies ()) | |
| { | |
| string location = Path.GetDirectoryName (assembly.CodeBase).Replace (Path.DirectorySeparatorChar, '/'); | |
| if (location.StartsWith ("file:")) | |
| { | |
| location = location.Substring ("file:".Length); | |
| } | |
| if (!location.BeginsWith (Application.dataPath.Substring (0, Application.dataPath.Length - "Assets".Length))) |
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
| public static Color A (this Color color, float alphaScale) | |
| { | |
| return new Color (color.r, color.g, color.b, color.a * alphaScale); | |
| } | |
| // Gizmos.color = Color.red.A (0.3f); |
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
| class MyBehaviour : MonoBehaviour | |
| { | |
| public MyBehaviour Init (int some, float parameters) | |
| { | |
| //... | |
| return this; | |
| } | |
| } | |
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; | |
| using System.IO; | |
| public class MultiScene | |
| { | |
| [MenuItem ("File/Combine Scenes")] | |
| static void Combine () | |
| { |
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.Reflection; | |
| public class TerriblyHackyLog : MonoBehaviour | |
| { | |
| void Start () | |
| { | |
| Log ("Aaaaarrrrgh!"); | |
| } |
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
| public static void AddAxis (AxisDefinition axis) | |
| { | |
| if (AxisDefined (axis.name)) | |
| { | |
| throw new System.ArgumentException (string.Format ("Specified axis \"{0}\" already exists", axis.name)); | |
| } | |
| SerializedObject serializedObject = new SerializedObject (AssetDatabase.LoadAllAssetsAtPath ("ProjectSettings/InputManager.asset")[0]); | |
| SerializedProperty axesProperty = serializedObject.FindProperty ("m_Axes"); |
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
| Texture2D[] m_Numbers, m_Digits; | |
| void SetValue (int value) | |
| { | |
| if (value >= Mathf.Pow (10, m_Digits.Length)) | |
| { | |
| Debug.LogError ("Value overflow: Unable to display value: " + value); | |
| } | |
| for (int i = m_Digits.Length - 1; i >= 0; --i) |
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
| void OnGesture (Gesture gesture) | |
| { | |
| switch (gesture.type) | |
| { | |
| case GestureType.Swipe: | |
| if (Vector2.Dot (gesture.direction, new Vector2 (1.0f, 0.0f)) > 0.8f) | |
| { | |
| Previous (); | |
| } | |
| else if (Vector2.Dot (gesture.direction, new Vector2 (-1.0f, 0.0f)) > 0.8f) |
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
| void OnGUI () | |
| { | |
| BeginRenderTextureGUI (m_TargetTexture); | |
| GUILayout.Box ("This box goes on a render texture!"); | |
| EndRenderTextureGUI (); | |
| } | |
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
| if (m_BroadcastTimer == null) | |
| // Setup broadcast of hosting service | |
| { | |
| m_BroadcastSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | |
| try | |
| { | |
| IPAddress broadcastGroup = IPAddress.Parse (kBroadcastGroup); | |
| m_BroadcastSocket.SetSocketOption ( |