Skip to content

Instantly share code, notes, and snippets.

View aleverdes's full-sized avatar
🐒

Alex Travkin aleverdes

🐒
View GitHub Profile
@aleverdes
aleverdes / ReactiveProperty.cs
Created October 5, 2023 08:16
ReactiveProperty<T> for Unity
using System;
using UnityEngine;
namespace SunnyverseGames
{
[Serializable]
public sealed class ReactiveProperty<T>
{
[SerializeField] private T _value;
@aleverdes
aleverdes / Arc.cs
Created September 8, 2022 12:21
Script for drawing an arc
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityOpenXR
{
public class Arc : MonoBehaviour
{
public int SegmentCount = 60;
public float Thickness = 0.01f;
@aleverdes
aleverdes / InputDeviceManager.cs
Last active December 12, 2023 22:15
Unity OpenXR InputDeviceManager
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class InputDeviceManager : MonoBehaviour
{
private HashSet<string> _loadedControllerInputDevices;
public InputDevice LeftController;
public InputDevice RightController;
@aleverdes
aleverdes / TryGetComponentExtensions.cs
Last active October 6, 2021 10:15
A set of extension methods for declaring, getting, and checking for the existence of components in a single step.
using UnityEngine;
public static class TryGetComponentExtensions
{
#region GameObject Extensions
#if !UNITY_2019_1_OR_NEWER
public static bool TryGetComponent<T>(this GameObject gameObject, out T component) where T : Component
{
component = gameObject.GetComponent<T>();