Skip to content

Instantly share code, notes, and snippets.

@iendsl
iendsl / PrefabLock.cs
Created October 7, 2020 03:51
A Unity component that prevents a user from editing a prefab in the Scene view.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.SceneManagement;
#endif
[ExecuteInEditMode]
@iendsl
iendsl / DirectCameraWindow.cs
Last active September 18, 2020 02:21
A Unity Editor Window for rendering a camera you reference directly. Works with cameras in Prefab Staging scene. Put inside an "Editor" folder, like Assets/Editor.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Experimental.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
//drawing a camera in gui:
//https://answers.unity.com/questions/312472/how-to-change-size-of-camera-preview-in-editor.html
@iendsl
iendsl / ShadowNoLight.shader
Created October 4, 2017 06:14
Shader Used in A Good Gardener
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Custom/Cutout/ShadowNoLight" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_Cutoff ("Alpha Cutoff", Float) = 0.5
}
SubShader {
using UnityEngine;
using System.Collections;
public class DogWalkingBehavior : MonoBehaviour {
#region properties
delegate void DogBehavior();
DogBehavior currentDogBehavior;
public GameObject[] followSpots;
using UnityEngine;
using System.Collections;
public class GridSystem : MonoBehaviour {
public static GridSystem grid;
public GameObject bottomLeftObject;
public GameObject topRightObject;
public float gridSize;