Skip to content

Instantly share code, notes, and snippets.

View TarasOsiris's full-sized avatar
🌍
https://ninevastudios.com/

Taras Leskiv TarasOsiris

🌍
https://ninevastudios.com/
View GitHub Profile
@TarasOsiris
TarasOsiris / CheckForUpdates.cs
Last active May 25, 2016 15:28
Check for upates on GitHub form Unity Editor
private const string LatestReleaseApiURL = "https://api.github.com/repos/getsocial-im/getsocial-unity-sdk/releases/latest";
private const string LatestReleaseURL = "https://github.com/getsocial-im/getsocial-unity-sdk/releases/latest";
[MenuItem(GetSocialMenuParent + "GetSocial/Check for Updates...", false, priority: 2000)]
public static void CheckForUpdates()
{
CheckForUpdatesOnReleaseRepo();
}
private static void CheckForUpdatesOnReleaseRepo()
@TarasOsiris
TarasOsiris / ShowToastUnityAndroid.cs
Created April 15, 2016 12:52
Shows toast on Android
public static void ShowToast(string text)
{
if (Application.platform == RuntimePlatform.Android)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
activity.Call("runOnUiThread", new AndroidJavaRunnable(
()=>
{
@TarasOsiris
TarasOsiris / Driver.cs
Last active April 15, 2016 09:52
Class for frame-by-frame Animation in Editor. Taken from Fabric Unity SDK
namespace Fabric.Internal.Editor.View.Animation
{
using UnityEngine;
using UnityEditor;
using System.Collections;
using System;
public class Driver
{
private uint invocationCount = 0;
@TarasOsiris
TarasOsiris / BetterDefines.cs
Last active April 21, 2023 20:22 — forked from Borod4r/BetterDefines.cs
Better Defines for Unity3D
using System;
using System.Collections.Generic;
using System.Linq;
using BetterDefines.Editor.Entity;
using UnityEditor;
namespace BetterDefines.Editor
{
public static class BetterDefinesUtils
{
@TarasOsiris
TarasOsiris / GetSocialDeepLinkingActivity.java
Created March 4, 2016 14:59 — forked from getsocial-im/GetSocialDeepLinkingActivity.java
Code for Android Unity App and the Intent Trouble Article on GetSocial Blog
package im.getsocial.sdk.core.unity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import im.getsocial.sdk.core.GetSocial;
import im.getsocial.sdk.core.util.Log;
@TarasOsiris
TarasOsiris / GetSocialDeepLinkingActivity.java
Last active April 26, 2016 03:04
This activity is created because we cannot get Activity.onNewIntent callback in Unity when the app is running in background.
package im.getsocial.sdk.core.unity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import im.getsocial.sdk.core.GetSocial;
import im.getsocial.sdk.core.util.Log;
@TarasOsiris
TarasOsiris / FlowMap.shader
Last active April 20, 2023 07:36
Flow Map Shader for Unity3D. Used with Sprites.
Shader "Custom/Flow Map"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
// Flow
_FlowMap ("Flow Map", 2D) = "white" {}
_FlowSpeed ("Flow Speed", float) = 0.05
@TarasOsiris
TarasOsiris / EncryptedXmlSerializer.cs
Created January 11, 2015 23:23
Stack Overflow Question
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Xml.Serialization;
using UnityEngine;
namespace Com.Nravo.FlipTheBoard.PersistantStorage
{
@TarasOsiris
TarasOsiris / NGUI_UpdateLabel.cs
Created November 27, 2014 11:32
Updates NGUI Label with provided parameters. Playmaker Action
using UnityEngine;
using HutongGames.PlayMaker;
[ActionCategory("NGUI")]
[HutongGames.PlayMaker.Tooltip("Updates NGUI Label with provided parameters")]
public class NGUI_UpdateLabel : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(UILabel))]
[HutongGames.PlayMaker.Tooltip("Game Object to update.")]
using UnityEngine;
public static class CameraExtensions {
public static void LayerCullingShow(this Camera cam, int layerMask) {
cam.cullingMask |= layerMask;
}
public static void LayerCullingShow(this Camera cam, string layer) {
LayerCullingShow(cam, 1 << LayerMask.NameToLayer(layer));