GUIStyle mystyle = new GUIStyle("some string from the list below");
- "CN Box"
- "Button"
| static Lifecycle() => Debug.Log(Prefix + "Static Constructor"); | |
| [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void Subs() => Debug.Log(Prefix + "Subsystem Registration"); | |
| [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] static void AfterAsm() => Debug.Log(Prefix + "AfterAssembliesLoaded"); | |
| [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] static void BeforeSlash() => Debug.Log(Prefix + "Before Splash"); | |
| [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] static void BeforeScene() => Debug.Log(Prefix + "BeforeScene"); | |
| private void Awake() => Debug.Log(Prefix + "Awake"); | |
| private void OnEnable() => Debug.Log(Prefix + "OnEnable"); | |
| [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] static void AfterScene() => Debug.Log(Prefix + "AfterSceneLoad"); | |
| [RuntimeInitializeOnLoadMethod] static void DefaultLog() => Debug.Log(Prefix + "RuntimeInit Default"); | |
| void Start() => Debug |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.LowLevel; | |
| using RootMotion.FinalIK; | |
| // Disable IK and TwistRelaxers and set them on this to have them run before constraints and particle systems are evaluated. | |
| // Only one instance of IKRunner is possible, but it should be easy enough to extend. | |
| // Remember to call Start() on the TwistRelaxers once if they are disabled from the beginning. The IK may also need manual initialization. |
| using UnityEngine; | |
| using UnityEngine.LowLevel; | |
| using UnityEngine.PlayerLoop; | |
| public static class AddPlayerLoopCallback | |
| { | |
| // Add a callback to the PreUpdate phase | |
| [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] | |
| static void Setup() | |
| { |
| using UnityEditor; | |
| using UnityEngine.LowLevel; | |
| using UnityEngine.UIElements; | |
| public class ShowPlayerLoopWindow : EditorWindow | |
| { | |
| [MenuItem("Window/Player Loop")] | |
| static void ShowWindow() | |
| { | |
| var wind = GetWindow<ShowPlayerLoopWindow>(false, "Player Loop"); |
| using UnityEditor.Build; | |
| using UnityEditor.Build.Reporting; | |
| using UnityEngine; | |
| using UnityEditor.TestTools.TestRunner.Api; | |
| public class ResultCollector : ICallbacks | |
| { | |
| public ITestResultAdaptor Result { get; private set; } | |
| public void RunFinished(ITestResultAdaptor result) |
| static IEnumerable CastEnumerable(IEnumerable<object> input, Type t) | |
| { | |
| foreach(var o in input) | |
| { | |
| yield return Cast(o, t); | |
| } | |
| } | |
| static object Cast(object obj, Type t) |
| // Put this in an editor folder | |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEditor; | |
| using UnityEngine; | |
| using UnityEngine.Experimental.LowLevel; | |
| using UnityEngine.Profiling; |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text.RegularExpressions; | |
| //https://gist.github.com/darktable/1411710 | |
| namespace MiniJSON | |
| { | |
| //http://jsonpatch.com/ |
| private static int GetReferenceCount(Type type, string undesiredTypeName) | |
| { | |
| UriBuilder uri = new UriBuilder(type.Assembly.CodeBase); | |
| string path = Uri.UnescapeDataString(uri.Path); | |
| AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(path); | |
| TypeDefinition vm = assemblyDefinition.Modules.SelectMany(m => m.GetTypes().Where(p => p.FullName == type.FullName)).Single(); | |
| int referenceCount = vm.Methods.Where(p => p.HasBody) | |
| .SelectMany(p => p.Body.Instructions.Where(i => i.OpCode.Code == Mono.Cecil.Cil.Code.Call && | |
| ((Mono.Cecil.MethodReference)i.Operand).DeclaringType.FullName.Equals(undesiredTypeName))).Count(); |