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
| /* To avoid performance issues caused by string constructions when logging stuff | |
| * to the console, simply surround the code with the the following: | |
| * | |
| * #if DEBUG_LOGGING | |
| * Debug.Log("my" + numer.ToString("0.00") " super" + " expensive " + " string building code"); | |
| * #endif | |
| * | |
| * When creating a non-debug build or testing the game for performance, simply disable | |
| * the debug messages from the Unity menu (menu name can be simply changed below). | |
| */ |
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 class TrajectoryCalculation : MonoBehaviour | |
| { | |
| public Rigidbody projectile; | |
| public Transform target; | |
| [Header("CalculateBestThrowSpeed")] | |
| public float timeToTarget = 1f; | |
| [Header("CalculateTrajectory")] |
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; | |
| // based on http://unitytipsandtricks.blogspot.com/2013/05/camera-shake.html | |
| public class PerlinShake : MonoBehaviour | |
| { | |
| public float duration = 2f; | |
| public float speed = 20f; | |
| public float magnitude = 2f; | |
| public AnimationCurve damper = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.9f, .33f, -2f, -2f), new Keyframe(1f, 0f, -5.65f, -5.65f)); |
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
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2016 Sayan Goswami <goswami.sayan47@gmail.com> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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 UnityEditorInternal; | |
| using System.Collections.Generic; | |
| using UnityEditor.AnimatedValues; | |
| [CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)] | |
| [CanEditMultipleObjects] | |
| public class CustomEditorBase : Editor | |
| { |
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 UnityEngine.VR; // you always need this to use special VR functions | |
| public class VRUtility : MonoBehaviour { | |
| // Use this for initialization | |
| public void Start () { | |
| // set render quality to 50%, sacrificing visual quality for higher FPS |
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 UnityEngine.VR; // we need this line here for InputTracking and VRSettings functions | |
| // USAGE: put this on a thing you want the player to look at! | |
| // this code will enable that thing to know if it is being looked at! | |
| [RequireComponent (typeof(Collider)) ] // this thing needs a collider if we should look at it | |
| public class RaycastTargetTrigger : MonoBehaviour { |
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; | |
| public static class Wm { | |
| const string DATABASE_ID_KEY = "MyCustomDatabase"; | |
| public static MyScriptableObject _db; | |
| public static MyScriptableObject Db { | |
| get { | |
| if (_db == null && EditorPrefs.HasKey(DATABASE_ID_KEY)) { | |
| _db = GetDatabaseFromStorage(); |
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 "Custom/Gamma Image Effect" { | |
| Properties | |
| { | |
| _MainTex ("Base (RGB)", 2D) = "white" {} | |
| _SaturationAmount ("Saturation Amount", Range(0.0, 1.0)) = 1.0 | |
| _BrightnessAmount ("Brightness Amount", Range(0.0, 1.0)) = 1.0 | |
| _ContrastAmount ("Contrast Amount", Range(0.0,1.0)) = 1.0 | |
| } | |
| SubShader | |
| { |
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 UnityEditorInternal; | |
| using UnityEngine; | |
| public class CopyComponents : EditorWindow { | |
| private GameObject originalObject = null; | |
| private GameObject targetObject = null; | |
| [MenuItem("Window/CopyComponent")] |
NewerOlder