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.Reflection; | |
using System.Reflection.Emit; | |
using System; | |
using System.Collections.Generic; | |
namespace GetSetGenerator | |
{ | |
public interface IGetSet<TInstance, TField> | |
{ | |
TField Get(TInstance item); |
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; | |
public static class ByteArrayPool | |
{ | |
private static Queue<WeakReference> pool = new Queue<WeakReference>(); | |
public static ArraySegment<byte> Take(int count) | |
{ | |
// if there are any items to check in the pool |
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 Unity.Jobs; | |
using UnityEngine; | |
static internal class ComponentBatch<T, U, V> | |
where T : MonoBehaviourComponent<T, U, V> where U : MonoBehaviourSystem<T, U, V> | |
where V: struct, IJobParallelFor | |
{ | |
internal static Queue<T> components = new Queue<T>(); | |
internal static Queue<T> newComponents = new Queue<T>(); |
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 UnityEngine; | |
using System.Collections.Generic; | |
using System.Runtime.InteropServices; | |
using UnityEngine.Assertions; | |
[StructLayout(LayoutKind.Explicit)] | |
struct SpatialKey | |
{ | |
[FieldOffset(0)] public Int32 xz; |
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 Logger | |
{ | |
string header; | |
public bool enabled = true; | |
public Logger(string name, string color) | |
{ | |
header = $"<color={color}>{name}:</color>"; | |
} |
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 UnityEditor; | |
using UnityEngine; | |
public class CleanupMissingScriptsHelper | |
{ | |
[MenuItem("Assets/Cleanup Missing Scripts")] | |
private static void CleanupMissingScripts() | |
{ | |
foreach (var i in Selection.gameObjects) | |
{ |
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
#if USE_HDRP | |
public partial class SomeBehaviour : MonoBehaviour | |
{ | |
partial public void SomeMethod() { | |
} | |
} | |
#endif |
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 Unity.Collections; | |
using Unity.Entities; | |
using Unity.Jobs; | |
namespace PatternsOfDots | |
{ | |
/// <summary> | |
/// Add a WaitForSeconds component to your entity with a delay parameter. | |
/// The ScheduleSystem will then wait that many seconds before removing | |
/// the component, and add a Ready tag component. You can then process |
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 static Mesh Extract(Mesh m, int meshIndex) | |
{ | |
var vertices = m.vertices; | |
var normals = m.normals; | |
var newVerts = new List<Vector3>(); | |
var newNorms = new List<Vector3>(); | |
var newTris = new List<int>(); | |
var triangles = m.GetTriangles(meshIndex); | |
for (var i = 0; i < triangles.Length; i += 3) |
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 AI | |
{ | |
Domain CreateDomain() | |
{ | |
using (domain = Domain.New()) | |
{ | |
worldState = DefineWorldState(health, fuel, speed, angularSpeed); | |
DefinePrimitiveTask(SetRandomDestination); | |
DefinePrimitiveTask(MoveToDestination) |
NewerOlder