Skip to content

Instantly share code, notes, and snippets.

@DGriffin91
DGriffin91 / main.rs
Last active July 15, 2023 20:27 — forked from IceSentry/main.rs
Bevy post processing with prepass 0.10
// License: Apache-2.0 / MIT
// Adapted from https://gist.github.com/IceSentry/3949ee344857c2745dc961a64e6fc28f
//! This example shows how to create a custom render pass that runs after the main pass
//! and reads the color texture generated by the main pass, and also the prepass textures.
//!
//! This is a fairly low level example and assumes some familiarity with rendering concepts and wgpu.
use bevy::{
core_pipeline::{
@clarvalon
clarvalon / Gist.cs
Created September 24, 2019 22:11
FNA Net Core 3 using NativeLibrary (proof of concept - see TODOs)
// in Program.cs
// Get FNA Assembly
var fnaAssembly = Assembly.GetAssembly(typeof(Microsoft.Xna.Framework.Graphics.ColorWriteChannels));
// Register mechanism for determining native libraries based on NativeLibrary instead of DllImport
DllMap.Register(fnaAssembly);
// in DllMap.cs
using System;
@ulrikdamm
ulrikdamm / EditPrefab.cs
Last active May 14, 2024 16:41
Unity editor script for better editing of prefabs. Put in Assets/Editor.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser).
// This opens an empty scene with your prefab where you can edit it.
// Put this script in your project as Assets/Editor/EditPrefab.cs
public class EditPrefab {
static Object getPrefab(Object selection) {
@gravitylow
gravitylow / codesign_gdb.md
Last active April 16, 2024 02:18 — forked from hlissner/codesign_gdb.md
Codesign gdb on macOS

If you are getting this in gdb on macOS while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access
  2. In menu, open Keychain Access > Certificate Assistant > Create a certificate
  3. Give it a name (e.g. gdbc)
@tomkail
tomkail / ExtendedScriptableObjectDrawer.cs
Last active July 22, 2024 17:21
Displays the fields of a ScriptableObject in the inspector
// Developed by Tom Kail at Inkle
// Released under the MIT Licence as held at https://opensource.org/licenses/MIT
// Must be placed within a folder named "Editor"
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
package tiles
{
import simulation.collision.Segment;
//this defines tile geometry and generates it on command
//
//++TODO: this seems like some sort of factory; it also seems like there's probably a much smarter way to go about doing all of this crap
public interface TileEdgeArchetype
{
@larsiusprime
larsiusprime / AABB.as
Created April 21, 2016 16:59
collision
package simulation.collision
{
import math.vec2;
public class AABB
{
public var min:vec2;
public var max:vec2;
public function AABB(xmin:Number, ymin:Number, xmax:Number, ymax:Number)
@jringrose
jringrose / FindProjectReferences.cs
Last active June 17, 2022 21:34
Unity editor extension that uses spotlight on OSX for lightning fast project reference searches. Asset serialization mode should be set to "Force Text" in the editor settings.
/*
MIT License
Copyright (c) 2016 Jesse Ringrose
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
copies of the Software, and to permit persons to whom the Software is
@Jellybit
Jellybit / CameraControl.cs
Last active September 4, 2023 04:23
Super Metroid style camera for Unity3D.
using UnityEngine;
using System.Collections;
// This is basically how the Super Metroid camera worked. Whichever direction you moved, the camera would
// move in the same direction a multiple of the player's speed. Once the center of the camera moved a
// certain distance from the player, the camera would lock on the player and move the same speed. Change
// movement direction, and the camera would once again move more quickly to catch up and place itself
// ahead of the player's movement.
// Super Metroid also had area limits and locked certain axes based on where you were. For instance, if
@prime31
prime31 / ParticleFlock.cs
Created May 1, 2014 17:42
Simple (unoptimized!) particle flock. Stick it on a GameObject with a ParticleSystem and play with inspector for some interesting results. Clicking anywhere on screen will set the target position for all boids.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent( typeof( ParticleSystem ) )]
public class ParticleFlock : MonoBehaviour
{
public Vector3 targetPosition;
public int totalBoids = 15;