Skip to content

Instantly share code, notes, and snippets.

using System;
using UnityEngine;
using UnityEngine.UI;
public class PushKeyGenerator : MonoBehaviour
{
public Text showUniqueKey;
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
@bhupiister
bhupiister / GoogleSignIn.cs
Last active May 4, 2020 13:56
Unity Google Sign in plugin with Firebase, App crashes with error configuration is null!? and Request not configured! Failing authenticate
namespace Google {
using System;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using Google.Impl;
using UnityEngine;
public class GoogleSignIn {
#if !UNITY_ANDROID && !UNITY_IOS
@bhupiister
bhupiister / GoogleSignInImpl.cs
Last active March 23, 2022 11:15
Unity Google Sign in plugin with Firebase, App crashes with error configuration is null!? and Request not configured! Failing authenticate
namespace Google.Impl {
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
internal class GoogleSignInImpl : BaseObject, ISignInImpl {
#if UNITY_ANDROID
private const string DllName = "native-googlesignin";
@bhupiister
bhupiister / PanAndZoom.cs
Created May 11, 2020 21:53
Pan and Zoom script for unity for all platforms
using UnityEngine;
using System;
using System.Collections.Generic;
using UnityEngine.EventSystems;
/// <summary> A modular and easily customisable Unity MonoBehaviour for handling swipe and pinch motions on mobile. </summary>
public class PanAndZoom : MonoBehaviour
{
/// <summary> Called as soon as the player touches the screen. The argument is the screen position. </summary>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Handles line drawing. Stores data for a line.
/// </summary>
[RequireComponent(typeof(SpriteRenderer))]
public class Line : MonoBehaviour
{
#if UNITY_ANDROID || UNITY_IOS || UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Firebase;
using Firebase.Auth;
using Google;
using UnityEngine;
using UnityEngine.SceneManagement;
@bhupiister
bhupiister / accelerometertest.js
Created February 28, 2023 03:51
React Native Accelerometer maximum frequency test
//Maximum i could get on Iphone was 100 Hz, if someone has idea to improve on this, let me know in comments
//Android i could get around 160 hz
//Both test were done on https://snack.expo.dev/ by pasting the below code and testing on expo app.
//For android i have read the following
//If you need an update interval less than 200ms, you should: add android.permission.HIGH_SAMPLING_RATE_SENSORS to app.json permissions field
//or if you are using bare workflow, add <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS"/> to AndroidManifest.xml.
import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';