Skip to content

Instantly share code, notes, and snippets.

View jeffvella's full-sized avatar
🏠
Working from home

Jeffrey Vella jeffvella

🏠
Working from home
  • Montréal, Canada
View GitHub Profile
@jeffvella
jeffvella / NativeDebugger.cs
Last active September 28, 2023 13:17
Debug Logger that works in burst and any thread.
using System;
using System.Diagnostics;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Jobs.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEditor;
using Debug = UnityEngine.Debug;
using System.Runtime.CompilerServices;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Unity.Physics.Authoring;
#if UNITY_EDITOR
using UnityEditor;
#endif
[Serializable]
/*
MIT License
Copyright (c) 2019 Ondrej Petrzilka
// https://github.com/OndrejPetrzilka/EntityComponentInspector
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
using System;
using UnityEngine;
[CreateAssetMenu(menuName = "Data/" + nameof(Ingredient))]
public unsafe class Ingredient : ScriptableObjectDataProvider<Ingredient.IngredientData>
{
public enum Id
{
None = 0,
Carrot,
using System;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using UnityEngine;
public struct TerrainSprite
{
using System.Runtime.CompilerServices;
using Unity.Mathematics;
using Unity.Physics;
namespace NativeOctree
{
public struct Aabb4
{
public float4 MinXs;
public float4 MaxXs;
# %bb.0: # %entry
sub rsp, 120
.seh_stackalloc 120
vmovdqa xmmword ptr [rsp + 96], xmm12 # 16-byte Spill
.seh_savexmm 12, 96
vmovdqa xmmword ptr [rsp + 80], xmm11 # 16-byte Spill
.seh_savexmm 11, 80
vmovdqa xmmword ptr [rsp + 64], xmm10 # 16-byte Spill
.seh_savexmm 10, 64
vmovdqa xmmword ptr [rsp + 48], xmm9 # 16-byte Spill
# %bb.0: # %entry
sub rsp, 24
.seh_stackalloc 24
vmovaps xmmword ptr [rsp], xmm6 # 16-byte Spill
.seh_savexmm 6, 0
.seh_endprologue
.Ltmp0:
.file 2 "C:/Users/Jeffrey/Desktop/GitSource/New Unity Project/Assets/Tests\\NewTestScript.cs"
.loc 2 258 0 prologue_end # NewTestScript.cs:258:0
vmovsd xmm0, qword ptr [rcx] # xmm0 = mem[0],zero
private class OctreeSystem : SystemBase
{
public bool IsCreated { get; private set; }
private Stopwatch _sw1;
private Stopwatch _sw2;
public bool DebugLogging { get; set; }
protected override void OnUpdate() { }
@jeffvella
jeffvella / UnsafeEntityManager2.cs
Last active April 12, 2020 00:32
native Exists call for Flipps
public unsafe struct UnsafeEntityManager2
{
[NativeDisableUnsafePtrRestriction]
private UnsafeDataComponentStore* _componentDataStore;
public UnsafeEntityManager2(EntityManager em)
{
var entity = em.CreateEntity();
var chunk = em.GetChunk(entity);
_componentDataStore = (UnsafeDataComponentStore*)chunk.GetComponentDataStorePtr();