Skip to content

Instantly share code, notes, and snippets.

@Spoilerast
Spoilerast / DocumentExtensions.cs
Last active May 10, 2025 08:59
Unity3D UI Toolkit extensions for cleaner code
using UnityEngine;
using UnityEngine.UIElements;
namespace Extensions
{
public static class DocumentExtensions
{
public static void FindFirstVisualElement<V>(this UIDocument document, out V visualElement)
where V : VisualElement
{
//using UnityEngine;
#ROOTNAMESPACEBEGIN#
//namespace {
internal sealed class #SCRIPTNAME# : SceneObject
{
#NOTRIM#
}
//}
#ROOTNAMESPACEEND#
@Spoilerast
Spoilerast / SceneObject.cs
Last active May 10, 2025 09:05
Parent class for all entities on scene (Unity3D)
using UnityEngine;
[DisallowMultipleComponent]
public abstract class SceneObject : MonoBehaviour
{
/*Parent class for all entities on scene*/
protected Vector3 Position => transform.position;
internal void Activate()
@Spoilerast
Spoilerast / ActionsMap.cs
Last active May 10, 2025 06:57
Inputs Manager for Unity InputSystem. Forget about wall of useless text
using System;
//namespace Make.Namespace.Name {
/// <summary>
/// 'InputActionsMap' is name of your class created by InputSystem.
/// Go to Input Action Asset,
/// make flag on Generate C# Class,
/// fill C# Class Name ('InputActionsMap'),
/// fill C# Class Namespace (optional)