Skip to content

Instantly share code, notes, and snippets.

@Chaosed0
Chaosed0 / DelegateEventUnit.cs
Created Sep 8, 2020
Bolt unit for running a flow when a delegate is called. Only supports no-argument delegates.
View DelegateEventUnit.cs
using UnityEngine;
using System.Collections.Generic;
using Bolt;
using Ludiq;
[UnitTitle("Delegate Event")]
[SpecialUnit]
public class DelegateEventUnit : Unit, IEventUnit, IGraphEventListener, IGraphElementWithData
{
public class Data : IGraphElementData
@Chaosed0
Chaosed0 / ModifyColor.cs
Last active Apr 17, 2019
Component to pass color to shader through property
View ModifyColor.cs
using UnityEngine;
using System.Collections.Generic;
[ExecuteInEditMode]
public class ModifyColor : MonoBehaviour
{
private static MaterialPropertyBlock materialPropertyBlock = null;
[SerializeField]
private string propertyName = "_Color";
@Chaosed0
Chaosed0 / Rimlight.shader
Created Apr 17, 2019
Simple rim light shader
View Rimlight.shader
Shader "Custom/Rimlight" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_RimValue ("Rim value", Range(0, 1)) = 0.5
}
SubShader {
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
CGPROGRAM
#pragma surface surf Lambert alpha
View SolidProjector.shader
Shader "Projector/Solid Projector" {
Properties{
_Color("Tint Color", Color) = (1,1,1,1)
_ShadowTex("Cookie", 2D) = "gray" {}
}
Subshader
{
Tags {"Queue" = "Transparent" "RenderType" = "Transparent"}
Pass
{
@Chaosed0
Chaosed0 / LowFovCameraUtilityEditor.cs
Created Apr 8, 2019
A Unity Editor utility for cameras with extremely low FOV.
View LowFovCameraUtilityEditor.cs
using UnityEngine;
using UnityEditor;
using Cinemachine;
using System.Collections.Generic;
// To make this work, create an empty MonoBehaviour called "LowFovCameraUtility".
// Then, attach that script to your Cinemachine virtual cameras.
// If you don't want to use Cinemachine virtual cameras this script should work too,
// you'll just need to modify the components and variable names.
[CustomEditor(typeof(LowFovCameraUtility))]
View CallbackMap.cpp
#include "Callbacks.h"
void CallbackMap::setCallback(const std::string& callbackName, Callback callback)
{
map[callbackName] = callback;
}
CallbackMap::Error CallbackMap::call(const std::string& callbackName, const std::string& args)
{
auto iter = map.find(callbackName);
@Chaosed0
Chaosed0 / UE4WallSconce.cpp
Last active May 16, 2020
Example AActor-derived class for Unreal Engine 4
View UE4WallSconce.cpp
/* An example UE4 class derived from AActor. It plays a
* sound when an actor enters the bounding box, and lets
* the player turn a PointLight on and off using the "Use"
* key. It originally existed as a blueprint. */
/* WallSconceCpp.h */
#pragma once
#include "GameFramework/Actor.h"