Skip to content

Instantly share code, notes, and snippets.

View SanketRJDave's full-sized avatar
🏠
Working from home

Sanket Dave SanketRJDave

🏠
Working from home
  • India
View GitHub Profile
@unitycoder
unitycoder / CaptureScreen.cs
Created July 18, 2021 20:30
Capture Screenshot Async
// https://forum.unity.com/threads/resulting-screenshot-image-in-game-is-upside-down-and-not-correctly-positioned.848230/
using UnityEngine;
using UnityEngine.Rendering;
using Unity.Collections;
using System;
using System.IO;
using System.Collections;
 
public class CaptureScreen : MonoBehaviour
{
@ruzrobert
ruzrobert / Vibration.cs
Last active April 2, 2024 08:16
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
@JohannesMP
JohannesMP / UIBlur.shader
Last active April 18, 2024 21:12
UI.Image Blur Shader with layering and masking support
Shader "Custom/UIBlur"
{
Properties
{
[Toggle(IS_BLUR_ALPHA_MASKED)] _IsAlphaMasked("Image Alpha Masks Blur", Float) = 1
[Toggle(IS_SPRITE_VISIBLE)] _IsSpriteVisible("Show Image", Float) = 1
// Internally enforced by MAX_RADIUS
_Radius("Blur Radius", Range(0, 64)) = 1
@ffyhlkain
ffyhlkain / ReferenceFinder.cs
Last active October 18, 2023 00:54
A reference finder for assets in a #Unity3d project.
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
namespace FoundationEditor.Editor.ReferenceFinder
{
@ProGM
ProGM / CheckMissingReferencesInUnity.cs
Last active July 18, 2023 14:22
Finding Missing References in Unity 5.4+
// Based on http://www.tallior.com/find-missing-references-unity/
// It fixes deprecations and checks for missing references every time a new scene is loaded
// Moreover, it inspects missing references in animators and animation frames
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.Linq;
[InitializeOnLoad]
// LoadingScreenManager
// --------------------------------
// built by Martin Nerurkar (http://www.martin.nerurkar.de)
// for Nowhere Prophet (http://www.noprophet.com)
//
// Licensed under GNU General Public License v3.0
// http://www.gnu.org/licenses/gpl-3.0.txt
using UnityEngine;
using UnityEngine.UI;
@vandersonarruda
vandersonarruda / simplegamecenter.cs
Last active March 19, 2024 05:43 — forked from coreyjs/simplegamecenter.cs
Unity3d Simple GameCenter Integration
using UnityEngine;
using System.Collections;
using UnityEngine.SocialPlatforms;
using UnityEngine.SocialPlatforms.GameCenter;
public class GameCenter : MonoBehaviour {
static ILeaderboard m_Leaderboard;
public int highScoreInt = 1000;
@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");
@kibotu
kibotu / UnityGetNativeAndroidVersion
Last active September 6, 2023 16:27
Get versionCode and versionName with unity.
//int vesioncode = context().getPackageManager().getPackageInfo(context().getPackageName(), 0).versionCode;
public static int GetVersionCode() {
AndroidJavaClass contextCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject context = contextCls.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject packageMngr = context.Call<AndroidJavaObject>("getPackageManager");
string packageName = context.Call<string>("getPackageName");
AndroidJavaObject packageInfo = packageMngr.Call<AndroidJavaObject>("getPackageInfo", packageName, 0);
return packageInfo.Get<int>("versionCode");
}
@mstevenson
mstevenson / Fps.cs
Last active April 19, 2024 03:04
An accurate FPS counter for Unity. Works in builds.
using UnityEngine;
using System.Collections;
public class Fps : MonoBehaviour
{
private float count;
private IEnumerator Start()
{
GUI.depth = 2;