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; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
public class ScriptExecutionOrder : Attribute | |
{ | |
public int order; | |
public ScriptExecutionOrder(int order) { this.order = order; } |
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 struct FogProperties | |
{ | |
public float EndDistance; | |
public float StartDistance; | |
public float Density; | |
public Color Color; | |
public FogMode Mode; | |
public bool Enabled; |
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 UnityEngine.PostProcessing; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Use this component to dynamically create a PostProcessingBehaviour and instantiate a PostProcessingProfile on a Camera | |
/// This allows you to dynamically modify at runtime the PostProcessingProfile, without modifying the asset. | |
/// This component keeps track of the Profile and Instances. This means that if 2 different camera use the same Profile, they will use the same Instance. | |
/// </summary> | |
[RequireComponent(typeof(Camera))] |
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 UnityEditor; | |
public static class EditorGUILayoutExtensions | |
{ | |
/// <summary> | |
/// Add a EditorGUILayout.ToggleLeft which properly handles multi-object editing | |
/// </summary> | |
public static void ToggleLeft(this SerializedProperty prop, GUIContent label, params GUILayoutOption[] options) |
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.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
public class EventSystemManaged : EventSystem | |
{ | |
static Stack<EventSystem> ms_PrevEventSystem = new Stack<EventSystem>(); | |
static bool ms_Forced = false; | |
protected override void OnEnable() |
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 ShaderRenderState | |
{ | |
public enum ZWrite //couldn't find any similar enum in UnityEngine.Rendering | |
{ | |
Off = 0, | |
On = 1 | |
} | |
public static void SetStencilRef(this Material mat, int value) { mat.SetInt("_StencilRef", value); } | |
public static void SetStencilComp(this Material mat, UnityEngine.Rendering.CompareFunction value) { mat.SetInt("_StencilComp", (int)value); } |
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.SceneManagement; | |
public static class UtilsScene | |
{ | |
/// <summary> | |
/// Returns true if the scene 'name' exists and is in your Build settings, false otherwise | |
/// </summary> | |
public static bool DoesSceneExist(string name) | |
{ | |
if (string.IsNullOrEmpty(name)) |
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 UtilsEnum | |
{ | |
public static bool HasFlag(this Enum mask, Enum flags) // Same behavior than Enum.HasFlag is .NET 4 | |
{ | |
#if DEBUG | |
if (mask.GetType() != flags.GetType()) | |
throw new System.ArgumentException( | |
string.Format("The argument type, '{0}', is not the same as the enum type '{1}'.", | |
flags.GetType(), mask.GetType())); | |
#endif |
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 ScriptableObjectSingleton<T> : ScriptableObject where T : ScriptableObject | |
{ | |
static T m_Instance = null; | |
public static T Instance | |
{ | |
get | |
{ | |
if (m_Instance == null) |