Skip to content

Instantly share code, notes, and snippets.

View andreiagmu's full-sized avatar
🎮
Developing NekoSuki! ~ Kitty Love Adventure 🐈❤️

Andrei Müller (Andy Miira) andreiagmu

🎮
Developing NekoSuki! ~ Kitty Love Adventure 🐈❤️
View GitHub Profile
@adammyhre
adammyhre / UniTaskHelpers.cs
Created August 25, 2024 18:29
A helper class for UniTask that implements a WhenAllSettled method, allowing all tasks to complete and capturing both successful results and exceptions.
using System;
using Cysharp.Threading.Tasks;
/// <summary>
/// Provides helper methods for working with UniTask, including methods to await multiple tasks
/// and capture their results or exceptions.
/// </summary>
public class UniTaskHelpers {
/// <summary>
/// Awaits two UniTasks and returns a tuple containing the results or exceptions for each task.
@adammyhre
adammyhre / FixUnityBrokenSelectionBase.cs
Created August 7, 2024 19:27
Custom Unity Editor Script to Fix [SelectionBase] for Consistent Parent Selection
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
// Put this in an Editor folder
[InitializeOnLoad]
public class FixUnityBrokenSelectionBase : Editor {
static List<Object> newSelection;
static Object[] lastSelection = { };
@adammyhre
adammyhre / ProjectSetup.cs
Last active May 16, 2025 04:15
Automated Unity Project Setup Script
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;
using UnityEngine;
using static System.Environment;
@adammyhre
adammyhre / AnimatorControllerCloneTool.cs
Last active September 23, 2024 03:15
Code to clone an existing Animator Controller Asset with or without Motions
using UnityEditor;
using UnityEditor.Animations;
public static class AnimatorControllerCloneTool {
[MenuItem("Assets/Clone Animator Controller", true)]
static bool CanCloneAnimatorController() {
return Selection.activeObject is AnimatorController;
}
[MenuItem("Assets/Clone Animator Controller")]
@adammyhre
adammyhre / ComponentCopier.cs
Last active September 23, 2024 03:16
Copy and Paste All Components Between GameObjects
#if UNITY_EDITOR
using UnityEditorInternal;
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
/// <summary>
/// A Unity editor extension for copying and pasting all components between GameObjects.
/// The tool supports handling multiple components of the same type and correctly restores
@yasirkula
yasirkula / SceneViewUIObjectPickerContextWindow.cs
Last active May 6, 2025 17:32
Select the UI object under the cursor via right click in Unity's Scene window
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_2021_2_OR_NEWER
using PrefabStage = UnityEditor.SceneManagement.PrefabStage;
using PrefabStageUtility = UnityEditor.SceneManagement.PrefabStageUtility;
@adammyhre
adammyhre / InspectorLock.cs
Last active May 12, 2025 04:28
Lock Inspector Icon and Transform Constrain Proportion Icon in Unity
using System.Reflection;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Toggles the Inspector lock state and the Constrain Proportions lock state.
/// </summary>
public static class LockInspector {
static readonly MethodInfo flipLocked;
static readonly PropertyInfo constrainProportions;
Available stats:
Ai - Carving.ApplyResults - TimeNanoseconds
Ai - Carving.BuildBVTree - TimeNanoseconds
Ai - Carving.Clipping - TimeNanoseconds
Ai - Carving.ConvexHulls - TimeNanoseconds
Ai - Carving.Prepare - TimeNanoseconds
Ai - Carving.ProjectVertices - TimeNanoseconds
Ai - CollectSources - TimeNanoseconds
Ai - Colliders - TimeNanoseconds
Ai - Components.NavMeshAgent.SendMessage - TimeNanoseconds
@TheSunCat
TheSunCat / DisblockOrigin.theme.css
Last active April 14, 2025 18:16
Hide all Nitro & Boost upsells in Discord!
/**
* @name Adblock for Discord
* @author TheSunCat and contributors
* @version 1.0.0
* @description We have moved to Codeberg! Follow the link below:
* @source https://codeberg.org/AllPurposeMat/Disblock-Origin
*/
#app-mount::before {
content: "The Disblock Origin theme has moved to Codeberg! Please check https://codeberg.org/AllPurposeMat/Disblock-Origin";
@spireggs
spireggs / ScrollRectAutoScroll.cs
Last active April 17, 2025 18:07 — forked from mandarinx/ScrollRectAutoScroll.cs
Unity3d ScrollRect Auto-Scroll, Dropdown Use: Places this component in the Template of Dropdown (with the ScrollRect component)
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
//comment the next line out if you aren't using Rewired
using Rewired;
[RequireComponent(typeof(ScrollRect))]
public class ScrollRectAutoScroll : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{