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
#pragma kernel Setup | |
#pragma kernel Runtime | |
struct RenderData | |
{ | |
float3 Position; | |
float4 Color; | |
}; | |
// From: https://thebookofshaders.com/11/ |
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.Generic; | |
using System.Linq; | |
using UnityEngine; | |
public class FPSCounterIMGUI : MonoBehaviour | |
{ | |
[SerializeField] int maxFrames = 100; | |
Queue<float> avgFPS = new Queue<float>(); |
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
// As an example it will look for the name specified in the SettingsProvider | |
using UnityEditor; | |
public static class PreferenceProviderExample | |
{ | |
[SettingsProvider] | |
public static SettingsProvider CreateSettingsProvider() | |
{ | |
var provider = new SettingsProvider("YourPreference", SettingsScope.User) |
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
protected override void OnUpdate() | |
NativeList<int> testList = new NativeList<int>(10, Allocator.TempJob); | |
Job. | |
WithCode( | |
() => { | |
for (int i = 0; i < 10; i++) | |
testList.Add(i); | |
} | |
) |
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 BetterBounds | |
{ | |
public Vector3 center; | |
public Vector3 size; | |
public Quaternion rotation; |
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 static class DebugExtensions | |
{ | |
public static void ClearConsole () | |
{ | |
var logentries = System.Type.GetType ("UnityEditor.LogEntries, UnityEditor.dll"); | |
var clearmethod = logentries.GetMethod ("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); | |
clearmethod.Invoke (null, null); | |
} |
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.Generic; | |
using System.Text.RegularExpressions; | |
using UnityEditor; | |
public static class SerializedPropertyExtensions | |
{ | |
// Takes the property path and does a regex to find all the sub paths to reach the actual object, | |
// then follows the path to find the actual SerializedProperty | |
// | |
// Example of how a property path string looks like in an extreme use case: |
NewerOlder