Skip to content

Instantly share code, notes, and snippets.

View rubit0's full-sized avatar

Ruben de la Torre rubit0

View GitHub Profile
using UnityEngine;
using UnityEngine.EventSystems;
namespace BIM2GO.Systems.App.UX
{
[RequireComponent(typeof(Camera))]
public class OrbitCameraController : MonoBehaviour
{
public Transform FocusTarget { get; private set; }
public bool UserInputEnabled { get; set; } = true;
@rubit0
rubit0 / .gitignore
Created June 12, 2023 09:17
Unity gitignore
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
@rubit0
rubit0 / ARGrabInteractable.cs
Created November 1, 2021 09:49
MRTK style grab interactable for Unity's XRTK
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
using UnityEngine.XR.Interaction.Toolkit.AR;
[RequireComponent(typeof(ARSelectionInteractable))]
public class ARGrabInteractable : ARBaseGestureInteractable
{
private const float PositionSpeed = 12f;
private const float DiffThreshold = 0.0001f;
@rubit0
rubit0 / LifecycleEventsTrigger.cs
Created September 1, 2021 09:38
Useful component to perform basic actions on Unity lifecycle events directly from the inspector ✨
using UnityEngine;
using UnityEngine.Events;
public class LifecycleEventsTrigger : MonoBehaviour
{
[SerializeField]
private UnityEvent onAwake;
[SerializeField]
private UnityEvent onStart;
[SerializeField]
@rubit0
rubit0 / index.html
Last active March 16, 2021 09:52
Dynamic app stores linker
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Get Google Maps</title>
<meta name="description" content="Get Google Maps on your smartphone.">
</head>
<body>
<script>
var googlePlayStoreLink = "https://play.google.com/store/apps/details?id=com.google.android.apps.maps&hl=de&gl=US";
@rubit0
rubit0 / DevDebug.cs
Last active March 5, 2021 17:44
Debug build only debug logging.
public static class DevDebug
{
[Conditional("UNITY_EDITOR")]
[Conditional("DEBUG")]
public static void Log(string message, UnityEngine.Object context = null)
{
if (context != null)
{
Debug.Log(message, context);
}
@rubit0
rubit0 / UIAutoSelectSelf.cs
Last active March 22, 2016 20:46
Attach this Script to any UI Element on your Canvas to make it self auto selected when it get's enabled. Useful for Gamepad only games!
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System.Collections;
[AddComponentMenu("Helpers/UI/Self Auto Selected")]
[RequireComponent(typeof(Selectable))]
public class UIAutoSelectSelf : MonoBehaviour
{
public bool AutoSelectOnEnable = true;
@rubit0
rubit0 / SpriteAnimationHandler.cs
Last active November 22, 2015 09:15
NextGenSprites Helper for Sprite Sheet Animations
using UnityEngine;
using NextGenSprites.Helpers;
using System.Collections.Generic;
namespace NextGenSprites.Animation
{
[RequireComponent (typeof(SpriteRenderer))]
public class SpriteAnimationHandler : MonoBehaviour
{
public bool SharedMaterial;
using UnityEngine;
using System.Collections;
[System.Serializable]
public class MaterialPropertieBlockContainer : ScriptableObject
{
public MaterialPropertyBlock Block;
}
using UnityEngine;
using NextGenSprites;
using UnityEditor;
using System.Collections;
public class CreateMaterialPropertyBlock : MonoBehaviour
{
[MenuItem("Assets/Create/Material Property Block")]
public static void GenerateMaterialPropertyBlock()
{