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
@gjroelofs
gjroelofs / Grid
Last active February 27, 2020 17:08
Burst & Grid
Problem:
Concept of entities with volume that define different characteristics which need
to be volume tested against for various gamelogic purposes. Previous iteration
was a grid implementation where these characteristics were represented as
bitflags, each `int` a gamelogic concept to be tested against. E.g. Pathing:
[None, Impassable, Occupied, Walkable, Flyable, Vaultable, Climbable,
Interactable, Teleporter, Staircase]
Any volume placed on the grid would OR added to the grid's characteristics
bitmasks of the cells it occupied.
// For the new DOTS animation. Although you need to use DrawMeshInstanced yourself, Hybrid renderer does not support instanced
// props for builtin.
Shader "Custom/VertexSkinning"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
@STARasGAMES
STARasGAMES / NativeStack.cs
Last active May 17, 2023 09:25
Unity Native Stack implementation
///////////////////////////////////////////////////////////////////////////////////////
// Native queue collection with fixed length. FILO.
// NativeStack<T> supports writing in IJobParallelFor, just use ParallelWriter and AsParallelWriter().
// Not tested to much, works for me with integers and unity 2019.3
//
// Assembled with help of:
// - NativeCounter example (https://docs.unity3d.com/Packages/com.unity.jobs@0.1/manual/custom_job_types.html)
// - How to Make Custom Native Collections (https://jacksondunstan.com/articles/4734)
// - source code of NativeQueue and NativeList
public static class EntityDiff
{
public static ComponentDiffResult<T1> Diff<T1, T2>(this Entity entity, World world = null)
where T1: struct, IComponentData, IEquatable<T1>
where T2: struct, IDiffComponent<T1>
{
if (world == null)
{
world = World.Active;
}
@guerro323
guerro323 / EntityEnumerable.cs
Created July 17, 2019 20:19
Enumerations on entities
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Generated by EntityEnumerable.tt (64 `foreach` combinations)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Jobs;
using UnityEngine.Jobs;
using Unity.Collections;
using Unity.Mathematics;
public class IJobParallelForFilterTest : MonoBehaviour
{
using UnityEngine;
using Unity.Entities;
using Unity.Collections;
using Unity.Transforms;
using Unity.Rendering;
public class ChunkIterationBootstrap : MonoBehaviour
{
[SerializeField] RenderMesh meshInstanceRenderer;
@unitycoder
unitycoder / NativeHashMapList.cs
Created October 3, 2018 06:26
Unity ECS Stuff & Snippets
// https://forum.unity.com/threads/hybrid-native-container-nativehashmaplist-tkey-tvalue.564118/
//#define DEBUG_HML
using Unity.Collections;
using System;
namespace E7.Native
{
/// <summary>
@karljj1
karljj1 / Unity Assembly Definition Debugger.cs
Last active March 27, 2024 17:18
Find out what assemblies are being built and how long each takes.
using System;
using System.Collections.Generic;
using System.Text;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
[InitializeOnLoad]
public class AsmdefDebug
{
@JohannesMP
JohannesMP / LICENSE
Last active March 9, 2024 11:26
[Unity3D] A Reliable, user-friendly way to reference SceneAssets by script.
/*******************************************************************************
* Don't Be a Jerk: The Open Source Software License.
* Adapted from: https://github.com/evantahler/Dont-be-a-Jerk
*******************************************************************************
* _I_ am the software author - JohannesMP on Github.
* _You_ are the user of this software. You might be a _we_, and that's OK!
*
* This is free, open source software. I will never charge you to use,
* license, or obtain this software. Doing so would make me a jerk.
*