Skip to content

Instantly share code, notes, and snippets.


Kenney KenneyNL

View GitHub Profile
View UnlitDirectionalTint.shader
// Made with Amplify Shader Editor
// Available at the Unity Asset Store -
Shader "Unlit/Directional Tint"
_MainTex("MainTex", 2D) = "white" {}
_Color("Color", Color) = (1,1,1,1)
_ColorA("ColorA", Color) = (1,1,1,1)
_ColorB("ColorB", Color) = (1,1,1,1)

Creating a Mac build with permissions set on Windows

In order for Mac users to be able to open a build created on Windows (using Unity) some permissions will have to be set. If you create a ZIP archive of your build you'll lose permissions. Instead;

  1. Download or purchase MobaXTerm XServer;
  2. Install and open, click on 'Start local terminal'
  3. Type 'cd ' and drag the folder of your project into the terminal, press enter.
  4. Type; chmod -x [your app name].app, press enter.
  5. Type; chmod 777 [your app name].app, press enter.
  6. (Optional) Type ls -l to check if the permissions were set, it should look something like drwxrwxrwx.
View GrassGeometry.shader
Shader "Custom/Grass Geometry Shader" {
[NoScaleOffset] _MainTex("Grass A", 2D) = "white" {}
[NoScaleOffset] _GrassTwo("Grass B", 2D) = "white" {}
_Splat("Splat", 2D) = "white" {}
_Cutoff("Cutoff", Range(0,1)) = 0.25
KenneyNL / CircularMenu.cs
Last active Jun 23, 2022
Circular menu sample code for Unity
View CircularMenu.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CircularMenu : MonoBehaviour{
public float radius = 100.0f;
public float offset = 0.0f;
void Start(){
View AssetForge_billboard.shader
Shader "Unlit/Billboard"
_MainTex ("Texture", 2D) = "white" {}
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "DisableBatching" = "True" }
View Billboard.shader
Shader "Custom/Billboard" {
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
View textureCombine.cs
Texture2D[] layers;
Texture2D compiledTexture = new Texture2D(layers[0].width, layers[0].height);
foreach(Texture2D layer in layers){
Color[] baseColors = compiledTexture.GetPixels();
Color[] layerColors = layer.GetPixels();
for(int p = 0; p < baseColors.Length; p++){
KenneyNL /
Created Apr 1, 2018
Flash ActionScript 3.0 apply color palette to BitmapData
var colorPalette = [0xFF5a3921, 0xFF6b8c42, 0xFF7bc67b, 0xFFffffb5];
function applyPalette(bitmap:BitmapData, palette:Array){
for(var x = 0; x < bitmap.width; x++){
for(var y = 0; y < bitmap.height; y++){
var pixel = bitmap.getPixel(x, y);
View sceneWindow.cs
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.Collections.Generic;
using System.IO;
// Scene selection
View gradientShader.shader
// Shader created with Shader Forge v1.38
// Shader Forge (c) Neat Corporation / Joachim Holmer -
// Note: Manually altering this data may prevent you from opening it in Shader Forge