Skip to content

Instantly share code, notes, and snippets.

View VictorHHT's full-sized avatar
🤠
Working Hard at Recreate Games

Victor He VictorHHT

🤠
Working Hard at Recreate Games
  • China
  • 11:08 (UTC +08:00)
View GitHub Profile
@VictorHHT
VictorHHT / VTCameraRotator.cs
Last active March 5, 2023 13:18
A tool designed to view models by manipulating the camera instead of the model itself, effectively view the model in every possible angle without the quirkiness in rotating the model. Having additional features like changing view distance, panning via either mouse or keyboard. Smooth has been added to all features for this tool to improve user e…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class VTCameraRotator : MonoBehaviour
{
public enum PanMethods { Mouse, Keyboard };
// The target of the camera rotate sphere
@VictorHHT
VictorHHT / VTMinMaxSlider.cs
Last active March 5, 2023 13:11
Unity MinMaxSlider Property Attribute, with carefully crafted OnGUI drawing to achieve a similar interaction logic like the piano key velocity MinMaxSlider in Apple's GarageBand
using System;
using UnityEditor;
using UnityEngine;
namespace Victor.Tools
{
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class VTMinMaxSlider : PropertyAttribute
{
internal Vector2 m_MinmaxLimit;
@VictorHHT
VictorHHT / VTRangeStep.cs
Last active April 19, 2024 23:30
Unity Range Step Slider Property Attribute, allow the user to increase a float value or int value by step, like 0.25f or 3 or 100.15f
using System;
using UnityEditor;
using UnityEngine;
// Use Example 1: [VTRangeStep(0f, 10f, 0.25f)]
// Use Example 2: [VTRangeStep(100, 1000, 25)]
namespace Victor.Tools
{
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class VTRangeStep : PropertyAttribute