Skip to content

Instantly share code, notes, and snippets.

View SachinGanesh's full-sized avatar
🎯
Focusing

Sachin SachinGanesh

🎯
Focusing
View GitHub Profile
@SachinGanesh
SachinGanesh / SignAndPackage.pl
Created May 21, 2018 08:33
Unity3D - Publish games to Mac App Store - Automated Tool
#!/usr/bin/perl
use File::Copy;
use File::Find;
use File::Path;
use Cwd;
# Exoa SignAndPackage script v1.3
# Author : Anthony Kozak :: exoa.fr
# Place this script in the same folder as the generated .app file from Unity
# YOU WOULD NEED IN THIS DIRECTOY:
@SachinGanesh
SachinGanesh / Singleton.cs
Created May 25, 2018 09:10
C# Singleton for Unity3D
using UnityEngine;
/// <summary>
/// Be aware this will not prevent a non singleton constructor
/// such as `T myT = new T();`
/// To prevent that, add `protected T () {}` to your singleton class.
/// </summary>
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
private static T _instance;
@SachinGanesh
SachinGanesh / SwipeControl.cs
Created May 25, 2018 13:45
Unity3D C# Swipe Control
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SwipeControl : MonoBehaviour
{
private Vector3 fp; //First touch position
private Vector3 lp; //Last touch position
private float dragDistance; //minimum distance for a swipe to be registered
@SachinGanesh
SachinGanesh / FPSCounter.cs
Last active May 31, 2018 06:55
FPSCounter for Unity3D C#
// Copyright 2014 Invex Games http://invexgames.com
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
@SachinGanesh
SachinGanesh / QualityManager.cs
Created May 31, 2018 06:57
Unity3D Dynamic Quality Settings based on FPS. Runtime reduction of quality based on device performance
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class QualityManager : Singleton<QualityManager> {
private int QUALITY_INDEX = 0;
public int MIN_FPS = 28;
public Text qualityUIText;
@SachinGanesh
SachinGanesh / Log.cs
Created June 4, 2018 17:02
Unity3d Custom Logger. Display called Class in the console
public class Log {
static bool ShowLogs = true;
Log(){
#if Debug
ShowLogs = true;
#else
ShowLogs = false;
#endif
}
@SachinGanesh
SachinGanesh / SynSpeech.cs
Created December 10, 2018 04:29
Example Program for SynSpeech & Unity3D (https://github.com/SynHub/syn-speech). Audio file is loaded from "StreamingAssets/Syn" directory
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Syn.Log;
using Syn.Speech.Api;
using Syn.Speech.Logging;
using UnityEngine;
using UnityEngine.UI;