View FBXAxesFixer.cs
using UnityEngine; | |
using UnityEditor; | |
public class FBXAxesFixer : AssetPostprocessor | |
{ | |
void OnPostprocessModel(GameObject g) | |
{ | |
if(assetImporter.ToString() == " (UnityEngine.FBXImporter)") | |
{ | |
FixFBXImport(g.transform, 0); |
View PathAttribute.cs
using UnityEngine; | |
public class PathAttribute : PropertyAttribute | |
{ | |
} |
View SetScriptExecutionOrder.cs
#if UNITY_EDITOR | |
private const int executionOrder = -1000; | |
[UnityEditor.InitializeOnLoadMethod] | |
private static void SetScriptOrder() | |
{ | |
var go = new GameObject("Temp"); | |
var monoScript = UnityEditor.MonoScript.FromMonoBehaviour(go.AddComponent<NAME_OF_THIS_MONOBEHAVIOUR>()); | |
if (UnityEditor.MonoImporter.GetExecutionOrder(monoScript) != executionOrder) | |
{ |
View StateMachine.cs
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. |
View ClassicEditorArrowMovement.cs
using UnityEngine; | |
using UnityEditor; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Re-enables pre-2018.x scene view camera behaviour for arrow keys. | |
/// Allows the user to move the scene view camera on a horizontal plane. | |
/// </summary> | |
public static class ClassicEditorArrowMovement | |
{ |
View CorouTweenTest.cs
using UnityEngine; | |
public class CorouTweenTest : MonoBehaviour | |
{ | |
[SerializeField] | |
private Vector3 targetPosition; | |
[SerializeField] | |
private float duration = 1; | |
private void Start() |
View CoroutineWorker.cs
using UnityEngine; | |
using System.Collections; | |
public static class CoroutineWorker | |
{ | |
private class Worker : MonoBehaviour { } | |
private static Worker worker; | |
[RuntimeInitializeOnLoadMethod] |
View CoroutinePoolThread.cs
using UnityEngine; | |
using System; | |
using System.Threading; | |
/// <summary> | |
/// Orders the Threadpool to perform an action and waits until it's done. | |
/// Use for short actions that maybe are performed more often. | |
/// </summary> | |
public class CoroutinePoolThread : CustomYieldInstruction | |
{ |
View ConsoleAccessAttribute.cs
using System; | |
[AttributeUsage(AttributeTargets.Method)] | |
public class ConsoleAccessAttribute : Attribute | |
{ | |
} |
View EventOrderTest.cs
using UnityEngine; | |
public class EventOrderTest : MonoBehaviour | |
{ | |
private bool firstUpdate = true; | |
private void Awake() | |
{ | |
Log("Awake"); | |
} |
OlderNewer