Skip to content

Instantly share code, notes, and snippets.

View ryan-at-melcher's full-sized avatar

ryan-at-melcher

View GitHub Profile
@ryan-at-melcher
ryan-at-melcher / FixAssetMainObjectNames.cs
Last active October 21, 2024 04:01
Automated/batch solution to fix "Main Object Name '{0}' does not match filename '{1}'" in Unity assets
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.PackageManager;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
/// <summary>
/// Adds a menu command to find and fix all assets that have mismatched main
/// object names and file names. I.e., "Main Object Name '{0}' does not match
@ryan-at-melcher
ryan-at-melcher / WorldSpaceHandVisual.cs
Last active July 5, 2024 21:18
Unity fix for OVRControllerHands prefab incorrectly positioning synthetic hands using a local-pose rather than world-pose.
using Oculus.Interaction;
using Oculus.Interaction.Input;
using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Renders the hand.
/// <br /><br />
///
@ryan-at-melcher
ryan-at-melcher / LayerFieldAttribute.cs
Created August 21, 2024 17:58
A simple attribute for Unity to display an int field in the inspector as a GameObject layer dropdown that is limited to one selection.
using UnityEngine;
/// <summary>
/// Allows a single GameObject layer to be selected from the inspector when applied to an
/// <see langword="int" /> field. Intended to be used when a <see cref="LayerMask" />'s
/// multiselection is not suitable.
/// </summary>
public class LayerFieldAttribute : PropertyAttribute
{
}