Skip to content

Instantly share code, notes, and snippets.

@AmbientLion
AmbientLion / InputManager.cs
Last active November 14, 2024 20:52
Unity Touch Input Tracking
using UnityEngine;
using UnityEngine.InputSystem;
public class InputManager : MonoBehaviour
{
// the class generates from the InputActions asset (your name can vary)
private TouchInputs touchInputs;
// tracks which object is currently actively receiving touch input
private InputReceiver currentReceiver;
// the last touch position that was recorded
@AmbientLion
AmbientLion / animatorControllerEditorWindow.cs
Last active November 9, 2024 09:47
Unity EditorWindow - Copying Parameters Between AnimatorController Assets.
/// Author: AmbientLion@github
/// Purpose: This is an Odin-based (https://odininspector.com) editor tool window that simplifies
/// the work for copying AnimatorController parameters from one controller to another.
using System;
using System.Collections.Generic;
using System.Linq;
using Sirenix.OdinInspector;
using Sirenix.OdinInspector.Editor;
using UnityEditor;
@AmbientLion
AmbientLion / SomeComponentEditor.cs
Created October 7, 2023 20:11
Prevent Focus Loss in Unity OnSceneGUI
/**
* This is an Editor class for some Component class
*/
[CustomEditor(typeof(SomeComponent))]
public class SomeComponentEditor : Editor {
// OnSceneGUI() is often used to paint or interact with objects in the Scene
// at edit time. Here we show how to prevent clicking on a game scene from
// resulting in a change of focused/selected element in the Scene hierarchy.
private void OnSceneGUI() {