Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Surfin the Chaos

Mike Wuetherick gekidoslair

💭
Surfin the Chaos
View GitHub Profile
View Unity FreeCam
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
/// <summary>
/// A simple free camera to be added to a Unity game object.
///
/// Keys:
View photon-pun-cheatsheet.md

Photon Methods

public class Blank : Photon.PunBehaviour

instead of mono behavior, use this to receive photon callbacks in your script.

public override void OnLeftRoom()

An example of overriding a punbehavior callback

View photon-pun-cheatsheet.md

Photon Methods

public class Blank : Photon.PunBehaviour

instead of mono behavior, use this to receive photon callbacks in your script.

public override void OnLeftRoom()

An example of overriding a punbehavior callback

@gekidoslair
gekidoslair / EditorNote.cs
Last active May 30, 2020
Add to any gameobject to provide scene-view annotations
View EditorNote.cs
using UnityEditor;
using UnityEngine;
namespace PixelWizards.Utilities
{
public class EditorNote : MonoBehaviour
{
[TextArea]
public string m_Text;
public Vector3 m_Offset;
@gekidoslair
gekidoslair / BoneDebug.cs
Created Apr 13, 2020
Simple tool that displays all of the bones that a particular mesh is bound to - useful for debugging skin weighting etc
View BoneDebug.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class BoneDebug : MonoBehaviour
{
SkinnedMeshRenderer skm;
public List<Transform> bones = new List<Transform>();
@gekidoslair
gekidoslair / TextureProcessor.cs
Last active Apr 13, 2020
Batch apply textures to materials
View TextureProcessor.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[System.Serializable]
public class MaterialEntry
{
public Material material;
public List<Texture2D> textures;
@gekidoslair
gekidoslair / textureassign.cs
Created Feb 18, 2020
Add textures to a material based on a naming convention
View textureassign.cs
/// <summary>
/// Grab the end of the string for our naming convention and see if it matches a known convention
/// </summary>
/// <param name="texture"></param>
/// <param name="material"></param>
private static void SetTexture(Texture2D texture, Material material)
{
var split = texture.name.Split('_');
var idx = split.Length - 1;
// Debug.Log("Postfix for texture: " + texture.name + " : " + split[idx]);
@gekidoslair
gekidoslair / PhysicsSettler.cs
Created Dec 30, 2019
Activate physics in Edit mode to dynamically drop or settle objects in a scene
View PhysicsSettler.cs
using UnityEngine;
using UnityEditor;
using UnityEditor.ShortcutManagement;
namespace PixelWizards.Utilities
{
// This causes the class' static constructor to be called on load and on starting playmode
[InitializeOnLoad]
class PhysicsSettler
@gekidoslair
gekidoslair / DistributeEvenly.cs
Last active Jan 26, 2020
Distribute GameObjects in a scene evenly (along x, y or z axis)
View DistributeEvenly.cs
using UnityEngine;
using UnityEditor;
using UnityEditor.ShortcutManagement;
namespace PixelWizards.Utilities
{
// This causes the class' static constructor to be called on load and on starting playmode
[InitializeOnLoad]
class PhysicsSettler
@gekidoslair
gekidoslair / CreateEmptyAtRoot.cs
Created Nov 10, 2019
Adds 'Create Empty at Root' shortcut for the GameObject / right-click context menu to create an empty gameobject at 0,0,0
View CreateEmptyAtRoot.cs
using UnityEditor;
using UnityEngine;
namespace MWU.Shared.Utilities
{
public class CreateEmptyAtRoot : MonoBehaviour
{
[MenuItem("GameObject/Create Empty at Root", false, 0)]
public static void Create()
You can’t perform that action at this time.