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
// Adds context menu to TextureImporter objects, saves .dds next to input texture, including mipmaps. | |
// Tested with Unity 2021.3.4 | |
using System; | |
using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
using Unity.Collections.LowLevel.Unsafe; | |
struct DDSHeader |
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.Generic; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
using Object = UnityEngine.Object; | |
public class MaterialGradientDrawer : MaterialPropertyDrawer { | |
private int resolution; |
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
(async()=>{ | |
const customCss = ` | |
#title-heading {clear:left} | |
`; | |
const asyncArray = (iter, map) => Promise.all(Array.from(iter, map)); | |
const css = (await asyncArray( | |
document.querySelectorAll('link[rel="stylesheet"][href^="/"]'), | |
async n => (await fetch(n.href, {mode: 'no-cors'})).text() | |
)).join("\n").replace(/\/\*.*?\*\//gs, ''); |
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.Generic; | |
using System.Text; | |
using UnityEditor; | |
using UnityEditor.Compilation; | |
using UnityEngine; | |
[InitializeOnLoad] | |
public class AsmdefDebug | |
{ |
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
public class UnityWebRequestAwaiter : INotifyCompletion | |
{ | |
private UnityWebRequestAsyncOperation asyncOp; | |
private Action continuation; | |
public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOp) | |
{ | |
this.asyncOp = asyncOp; | |
asyncOp.completed += OnRequestCompleted; | |
} |
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
// Learning from https://codeblog.jonskeet.uk/2012/01/30/currying-vs-partial-function-application/ | |
public void DoThings() | |
{ | |
Func<Vector3, PlayerController, IEnumerator> orig = MoveToLocationAction; | |
var t = ApplyPartial(orig, data.eventObjects[0].point); | |
var t1 = ApplyPartial(t, player); | |
var tt = ApplyPartial(orig, data.eventObjects[1].point); | |
var tt1 = ApplyPartial(t, player); |
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.UI; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
// Custom Editor to order the variables in the Inspector similar to Image component | |
[CustomEditor( typeof( CircleGraphic ) ), CanEditMultipleObjects] | |
public class CircleGraphicEditor : Editor | |
{ |
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 EnumFlagAttribute : PropertyAttribute | |
{ | |
public string enumName; | |
public EnumFlagAttribute() {} | |
public EnumFlagAttribute(string name) | |
{ |
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; | |
[InitializeOnLoad] | |
internal class PrefabExtension | |
{ | |
static PrefabExtension() | |
{ | |
UnityEditor.PrefabUtility.prefabInstanceUpdated += OnPrefabInstanceUpdate; | |
} |
NewerOlder