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.Collections; | |
public static class CoroutineWorker | |
{ | |
private class Worker : MonoBehaviour { } | |
private static Worker worker; | |
[RuntimeInitializeOnLoadMethod] |
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> | |
/// This template allows to define code that runs independently of any GameObjects or Components created in the editor, even though using Unity events. | |
/// It can be used for any Scene-independent code, including coroutines, without having to manually add a component to a scene. | |
/// </summary> | |
public static class MyStaticCode | |
{ | |
[RuntimeInitializeOnLoadMethod] | |
private static void Initialize() |
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; | |
[AttributeUsage(AttributeTargets.Method)] | |
public class ConsoleAccessAttribute : Attribute | |
{ | |
} |
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; | |
/// <summary> | |
/// A simple state machine class. Use it to run regular methods or coroutines as states. | |
/// Steps to use: | |
/// 1. Define a private field for the StateMachine object. | |
/// private StateMachine stateMachine; | |
/// 2. Initialize the object in Awake. Pass the MonoBehaviour object to the constructor. |
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 CorouTweenTest : MonoBehaviour | |
{ | |
[SerializeField] | |
private Vector3 targetPosition; | |
[SerializeField] | |
private float duration = 1; | |
private void Start() |
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 | |
{ | |
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; | |
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; | |
[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
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) |