Skip to content

Instantly share code, notes, and snippets.

View pr00thmatic's full-sized avatar

Ruth García pr00thmatic

View GitHub Profile
@pr00thmatic
pr00thmatic / HoldDetector.cs
Created November 2, 2025 01:15
a mobile touch hold detector: make sure the InputAction type is set to Button and the binding is set to "Press (Multi-Touch)", AKA: `<Touchscreen>/touch*/Press`
// a mobile touch hold detector: make sure the InputAction type is set to Button and the binding is set to "Press (Multi-Touch)", AKA: `<Touchscreen>/touch*/Press`
public class HoldDetector : MonoBehaviour
{
[SerializeField] private InputActionReference holdAction;
[SerializeField] private InputActionReference holdStartAction;
[SerializeField] private float distanceToleranceInPixels = 20;
private void OnEnable ()
{
holdAction.action.performed += HandleHoldSuccess;
namespace BitterSweetSuccess
{
public class NotTheHoldWeNeed_ButTheOneWeDeserve : MonoBehaviour
{
[Header("Initialization")]
[SerializeField] private InputActionReference holdAction;
[Header("Configuration")]
[SerializeField] private float distanceToleranceInPixels = 20;
namespace MediumSizedFailure
{
public class FailedHoldDetector : MonoBehaviour
{
public InputActionReference naiveHoldAction;
void OnEnable () => naiveHoldAction.action.performed += HandleHoldPerformed;
void OnDisable () => naiveHoldAction.action.performed -= HandleHoldPerformed;
private void HandleHoldPerformed (InputAction.CallbackContext context)
namespace HugeFailure
{
public class FailedHoldDetector : MonoBehaviour
{
public InputActionReference naiveHoldAction;
void OnEnable () => naiveHoldAction.action.performed += HandleHoldPerformed;
void OnDisable () => naiveHoldAction.action.performed -= HandleHoldPerformed;
private void HandleHoldPerformed (InputAction.CallbackContext context) =>
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MovimientoDelHeroe : MonoBehaviour {
[Header("Initialization")]
public Camera cam;
[Header("Information")]
public float speed = 30; // m/s
# name: playcanvas!
# key: lets-jam
# --
(() => {
var ${1:`
(concat (upcase (substring (file-name-base buffer-file-name) 0 1)) (substring (file-name-base buffer-file-name) 1))
`} = pc.createScript('${2:`
(concat (downcase (substring (file-name-base buffer-file-name) 0 1)) (substring (file-name-base buffer-file-name) 1))
`}');
using UnityEngine;
using UnityEngine.XR;
using System.Collections;
using System.Collections.Generic;
// en la documentación de Unity XRInput podrás leer más sobre
// los comandos usados en este script
// --> https://docs.unity3d.com/Manual/xr_input.html
public class OculusControllerExample : MonoBehaviour {
[Header("Configuration")]
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Arrow : MonoBehaviour {
[Header("Information")]
public bool isSelected = true;
public float distance = 0;
[Header("Initialization")]
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ArrowPorter : MonoBehaviour {
public static ArrowPorter selected;
[Header("Initialization")]
public Arrow arrowPrototype;
public Camera specialCamera;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
public class Dialogue : MonoBehaviour {
public static bool isOpen = false;
public static Dialogue Instance;
public static float timeClosed;