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.IO; | |
using System.Runtime.InteropServices; | |
using UnityEngine; | |
public static unsafe class FastVectorReader { | |
[StructLayout(LayoutKind.Explicit)] | |
private struct Union { | |
[FieldOffset(0)] public Vector2[] v2; | |
[FieldOffset(0)] public Vector3[] v3; |
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; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class needsmorejpeg : MonoBehaviour { | |
[RuntimeInitializeOnLoadMethod] | |
public static void NEEDSMOREJPEG() { | |
Camera cam = Camera.main; | |
if (cam == null) cam = GameObject.FindObjectOfType<Camera>(); | |
cam.gameObject.AddComponent<needsmorejpeg>(); |
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 System.Collections.Generic; | |
using UnityEngine; | |
// Example usage: | |
// | |
// [ReorderableList] | |
// public MyList myList; | |
// |
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.Linq.Expressions; | |
using System.Reflection; | |
[Serializable] | |
public class Function : Function<bool> { } | |
public abstract class Function<TReturn> : FunctionBase { | |
public TReturn Invoke() { | |
object o = base.Invoke(); |
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
// Put this file in a NON-editor folder | |
using UnityEngine; | |
using System; | |
[AttributeUsage(AttributeTargets.Field)] | |
public class MatrixTRSAttribute : PropertyAttribute { } | |
public static class MatrixTRSExtensions { | |
public static Quaternion ExtractRotation(this Matrix4x4 matrix) { |
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 UnityEditor; | |
public static class SerializedPropertyExtensions { | |
public static object GetValue(this SerializedProperty property) { | |
object targetObject = property.serializedObject.targetObject; | |
System.Type targetObjectClassType = targetObject.GetType(); | |
System.Reflection.FieldInfo field = targetObjectClassType.GetField(property.propertyPath); | |
if (field != null) { | |
object value = field.GetValue(targetObject); |
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 UnityEditor; | |
using UnityEngine; | |
using System; | |
// Create an editor window which can display a chosen GameObject. | |
// Use OnInteractivePreviewGUI to display the GameObject and | |
// allow it to be interactive. | |
public class PreviewSpriteMaker : EditorWindow { | |
private static GameObject gameObject; |
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.Generic; | |
/// <summary> | |
/// Class Extensions | |
/// </summary> | |
public static class ExtendedAnimationCurves { | |
public static void Serialize(this AnimationCurve anim, out float[] times, out float[] values) { | |
times = new float[anim.length]; | |
values = new float[anim.length]; |
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 DebugMesh : MonoBehaviour { | |
private MeshFilter filter { get { return _filter != null ? _filter : _filter = GetComponent<MeshFilter>(); } } | |
private MeshFilter _filter; | |
public bool showNormals = true; | |
public bool showTangents = true; | |
public float renderDistance = 10f; |