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; | |
public static class HideFlagsUtility | |
{ | |
[MenuItem("Help/Hide Flags/Show All Objects")] | |
private static void ShowAll() | |
{ | |
var allGameObjects = Object.FindObjectsOfType<GameObject>(true); | |
foreach (var go in allGameObjects) |
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.LowLevel; | |
using System.Collections.Generic; | |
using UnityEngine.PlayerLoop; | |
/// <summary> | |
/// Interpolates a GameObject's position and rotation while being updated in FixedUpdate. | |
/// </summary> | |
public class FixedUpdateInterpolation : MonoBehaviour |
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; | |
/// <summary> | |
/// Small helper class to convert viewport, screen or world positions to canvas space. | |
/// Only works with screen space canvases. | |
/// </summary> | |
/// <example> | |
/// <code> | |
/// objectOnCanvasRectTransform.anchoredPosition = specificCanvas.WorldToCanvasPoint(worldspaceTransform.position); | |
/// </code> |
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 UnityEditorInternal; | |
using System.Collections.Generic; | |
/// <summary> | |
/// An editor window that lets you store assets and GameObjects in it for quickly finding them again. | |
/// </summary> | |
public class FavoritesWindow : EditorWindow, IHasCustomMenu | |
{ |
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 System.Diagnostics; | |
/// <summary> | |
/// Simple benchmark class to measure average time consumption of code. | |
/// </summary> | |
public static class Benchmark | |
{ | |
/// <summary> | |
/// A benchmark's time result. |
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 System.Collections; | |
using UnityEngine; | |
/// <summary> | |
/// Replaces MonoBehaviour.Invoke and MonoBehaviour.InvokeRepeating | |
/// with a more sophisticated attempt. Namely: No strings involved. | |
/// Use like this: | |
/// StartCoroutine(Invoker.Invoke(MyMethod, 2)); | |
/// </summary> |
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; | |
using System.Collections; | |
using System.Collections.Generic; | |
/// <summary> | |
/// An event that can run coroutines. | |
/// Invoking it returns an IEnumerator that can be waited for in another coroutine. | |
/// The Invocation waits until all registered coroutines are finished. | |
/// </summary> |
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; | |
[System.Serializable] | |
public struct FloatRange | |
{ | |
public float min; | |
public float max; | |
public float range { get { return Mathf.Abs(max - min); } } | |
public FloatRange(float min, float max) |
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
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
[System.Serializable] | |
public struct RuntimeSceneReference : ISerializationCallbackReceiver | |
{ |
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; | |
/// <summary> | |
/// Use this attribute in combination with a [SerializeField] attribute on top of a property to display the property name. Example: | |
/// [field: SerializeField, UsePropertyName] | |
/// public int number { get; private set; } | |
/// </summary> | |
public class UsePropertyNameAttribute : PropertyAttribute | |
{ | |
NewerOlder