This file contains hidden or 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.IO; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
namespace AssetUsageFinder { | |
public class CacheManager { | |
Dictionary<string, AssetDependencies> _dict; |
This file contains hidden or 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
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++) { |
This file contains hidden or 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
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); |
This file contains hidden or 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
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]); |
This file contains hidden or 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.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); | |
} |
This file contains hidden or 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
#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); |
This file contains hidden or 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.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); |
This file contains hidden or 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 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) { |
This file contains hidden or 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 Subject<T> : IDisposable { | |
Action<T> _action; | |
bool _disposed; | |
public void Subscribe(Action<T> a) { | |
Asr.IsFalse(_disposed); | |
_action += a; | |
} | |
public void Publish(T msg) { |