Skip to content

Instantly share code, notes, and snippets.

EditorApplication.ExecuteMenuItem("Window/Analysis/Frame Debugger");
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace AssetUsageFinder {
public class CacheManager {
Dictionary<string, AssetDependencies> _dict;
void BuildGizmos() {
var occupiedComb = new List<CombineInstance>();
var freeComb = new List<CombineInstance>();
int xLen = _runtimeGrid.Len0, yLen = _runtimeGrid.Len1, zLen = _runtimeGrid.Len2;
var sharedMesh = Cube();
sharedMesh.hideFlags = HideFlags.DontSave;
for (var x = 0; x < xLen; x++)
for (var y = 0; y < yLen; y++)
for (var z = 0; z < zLen; z++) {
IEnumerator Interpolate(float3 p0, float3 p1) {
var maxProgress = 0f;
var segmentDelta = p1 - p0;
var len = math.distance(p1, p0);
var fwDelta = fwDeltaLen / len;
var segmentDir = math.normalize(segmentDelta);
while (true) {
float3 position = transform.position;
var progress = fwDelta + math.dot(position - p0, segmentDir) / len;
progress = math.clamp(progress, 0f, 1f);
static void CatmullRom(List<float3> input, List<float3> result) {
result.Clear();
if (input.Count <= 2) {
foreach (var p in input) result.Add(p);
return;
}
var count = input.Count;
// first curve
CatmullRom(input[0], input[0], input[1], input[2]);
using System.IO;
using UnityEngine;
namespace Asset_Cleaner.Serialization {
public static class PersistenceUtils {
public static void Load(ref Config result) {
var serializable = Deserialize();
AufSerializableData.OnDeserialize(in serializable, ref result);
}
#if UNITY_EDITOR_WIN
using System;
using UnityEngine;
using UnityEditor;
using System.Diagnostics;
class CreateSymlinkProject {
[MenuItem("Tools/Create Symlink Project")]
static void SymlinkProject() {
var src = Application.dataPath.Replace("/Assets", string.Empty);
using System;
using System.Runtime.CompilerServices;
using Leopotam.Ecs;
public static class EcsWorldExt
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool InFilter(this EcsEntity e, EcsFilter f)
{
ref var entityData = ref e.Owner.GetEntityData(e);
public static unsafe class BinaryWriterExtensions {
public static void Write(this IBinaryWriter writer, byte value) {
writer.WriteBytes(&value, 1);
}
public static void Write(this IBinaryWriter writer, int value) {
writer.WriteBytes(&value, sizeof(int));
}
public static void Write(this IBinaryWriter writer, ulong value) {
public class Subject<T> : IDisposable {
Action<T> _action;
bool _disposed;
public void Subscribe(Action<T> a) {
Asr.IsFalse(_disposed);
_action += a;
}
public void Publish(T msg) {