Skip to content

Instantly share code, notes, and snippets.

View psuong's full-sized avatar

Porrith Suong psuong

View GitHub Profile
@nidev
nidev / .vimrc
Last active December 3, 2023 18:35
How to use omnisharp-vim with latest omnisharp-roslyn
"All user-dependent configurations are omitted intentionally.
"This gist only includes configurations for omnisharp.
"Original vimrc is available on:
"https://github.com/OmniSharp/omnisharp-vim#example-vimrc
"=========================================================
" **Preparation steps
"1. Install pathogen.vim or preferred plugin manager
"(Will explain procedures with assumption that a user is using pathogen.vim)
" **Main steps
@timj-unity
timj-unity / system_update_order.md
Created March 21, 2018 00:19
Documentation for system update order

System update order

In ECS all systems are updated on the main thread. The order in which the are updated is based on a set of constraints and an optimization pass which tries to order the system in a way so that the time between scheduling a job and waiting for it is as long as possible. The attributes to specify update order of systems are [UpdateBefore(typeof(OtherSystem))] and [UpdateAfter(typeof(OtherSystem))]. In addition to update before or after other ECS systems it is possible to update before or after different phases of the Unity PlayerLoop by using typeof(UnityEngine.Experimental.PlayerLoop.FixedUpdate) or one of the other phases in the same namespace.

The UpdateInGroup attribute will put the system in a group and the same UpdateBefore and UpdateAfter attributes can be specified on a group or with a group as the target of the before/after dependency.

To use __UpdateIn

@jeffvella
jeffvella / PathTester.cs
Last active March 29, 2023 03:24
Find Path Tester for Unity Experimental Navigation
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.Collections;
using Unity.Mathematics;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Experimental.AI;
@jeffvella
jeffvella / TransformReader.cs
Created September 11, 2019 17:49
Reading GameObject Transform Component from pointer.
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public unsafe class TransformReader : MonoBehaviour
{
private NativeTransform* _transformPtr;
@jeffvella
jeffvella / GameData.cs
Created October 9, 2019 18:08
Experiment with ScriptableObject entity conversion
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
public struct LevelDataComponent : IComponentData
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Profiling;
@jeffvella
jeffvella / ProfilerMarker.cs
Last active May 11, 2020 21:21
How to add burst job timing to the profiler.
public unsafe class JobTestSystem : JobComponentSystem
{
private ProfilerMarker _marker;
protected override void OnCreateManager()
{
_marker = new ProfilerMarker("Job1z");
}
protected override JobHandle OnUpdate(JobHandle inputDeps)
using UnityEngine;
public class MeshBlit : MonoBehaviour
{
public RenderTexture rt;
public Mesh mesh;
public Material material;
public Vector3 meshPosition = new Vector3(0.5f, 0.5f, -1);
@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;
Shader "Hidden/JumpFloodOutline"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "PreviewType" = "Plane" }
Cull Off ZWrite Off ZTest Always