Skip to content

Instantly share code, notes, and snippets.

@yasirkula
yasirkula / MultiScreenshotCapture.cs
Last active February 23, 2026 12:18
Capture multiple screenshots with different resolutions simultaneously in Unity 3D
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace MultiScreenshotCaptureNamespace
{
internal static class ReflectionExtensions
@sdabet
sdabet / Behaviour.cs
Last active July 19, 2023 17:42
Simulating touch events from mouse events in Unity
void Update () {
// Handle native touch events
foreach (Touch touch in Input.touches) {
HandleTouch(touch.fingerId, Camera.main.ScreenToWorldPoint(touch.position), touch.phase);
}
// Simulate touch events from mouse events
if (Input.touchCount == 0) {
if (Input.GetMouseButtonDown(0) ) {
HandleTouch(10, Camera.main.ScreenToWorldPoint(Input.mousePosition), TouchPhase.Began);