Skip to content

Instantly share code, notes, and snippets.

View Bran04don's full-sized avatar
💭
Developing Games & Software

GravByte Bran04don

💭
Developing Games & Software
View GitHub Profile
@CharlieHess
CharlieHess / CircularTextMeshPro.cs
Last active July 17, 2024 14:01
Improved CircularTextMeshPro using OnPreRenderText
using UnityEngine;
using TMPro;
using Sirenix.OdinInspector;
/// <summary>
/// An extension of TextMeshPro that causes the text to be displayed in a
/// circular arc.
///
/// Adapted from https://github.com/TonyViT/CurvedTextMeshPro and improved.
/// TonyViT's version has some unnecessary properties and doesn't use the
@ttruty
ttruty / SwingingArmMotion.cs
Created January 9, 2023 22:13
Arm swinging locomotion for VR in Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SwingingArmMotion : MonoBehaviour
{
// Game Objects
[SerializeField] private GameObject LeftHand;
[SerializeField] private GameObject RightHand;
[SerializeField] private GameObject MainCamera;
@mstfmrt07
mstfmrt07 / MonoExtensions.cs
Last active February 22, 2023 13:32
A simple C# extension to easily create WaitForSeconds coroutines
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
public static class MonoExtensions
{
public static Coroutine Wait(this MonoBehaviour mono, float delay, UnityAction action)
{
return mono.StartCoroutine(ExecuteAction(delay, action));
}
@zutalor
zutalor / WalkDetectorVR.cs
Last active October 11, 2022 07:49
WalkDetectorVR
/*
Copyright 20XX, sysdia.com & GPepos
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@demonixis
demonixis / XRSubSystemTest.cs
Created January 13, 2020 13:28
A demonstration of how to use the all new XRSubsystem with Unity 2019.3+
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.Management;
public class XRSubSystemTest : MonoBehaviour
{
public void Start()
{
var xrSettings = XRGeneralSettings.Instance;
if (xrSettings == null)
@ruzrobert
ruzrobert / Vibration.cs
Last active July 12, 2024 20:49
Android Vibration for Unity 3D. Supports all API: 1 - 29 (auto detect), Amplitudes, Predefined Effects, both Legacy and >=26 APIs.
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
// Dont forget to add "using RDG;" to the top of your script!
namespace RDG
{
/// <summary>
/// Class for controlling Vibration. Automatically initializes before scene is loaded.
/// </summary>
public static class Vibration
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@aVolpe
aVolpe / Vibration.cs
Created October 16, 2014 02:45
Vibration for Unity3d with Android native Call, with fallback to Handlheld.Vibrate()
using UnityEngine;
using System.Collections;
public static class Vibration
{
#if UNITY_ANDROID && !UNITY_EDITOR
public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator");