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 / LoopedEnumList.cs
Last active August 29, 2015 14:06
Looped Enum List for Unity3D
using System.Collections.Generic;
using System;
using UnityEngine;
public class LoopedEnumList<T>
{
private readonly List<T> _items;
private readonly int _startIndex;
private int _currentIndex;
@TarasOsiris
TarasOsiris / RuntimePlatformUtils.cs
Last active August 29, 2015 14:05
RuntimePlatform utility class for Unity
using UnityEngine;
public static class RuntimePlatformUtils
{
private static RuntimePlatform _platform;
static RuntimePlatformUtils()
{
_platform = Application.platform;
}
@TarasOsiris
TarasOsiris / UnityExtensionMethods.cs
Last active January 25, 2022 12:17
Helper methods used within Unity3d
using UnityEngine;
public static class UnityExtensionMethods
{
#region go_utils
public static void Activate(this GameObject go)
{
go.SetActive(true);
}
@TarasOsiris
TarasOsiris / ListUtils.cs
Last active August 29, 2015 14:04
Collection extension methods
using System.Collections.Generic;
using System;
namespace TarasOsirisGists
{
public static class ListUtils
{
private static Random _rnd;
/// <summary>
@TarasOsiris
TarasOsiris / MonoSingleton.cs
Last active November 20, 2018 15:03
Singleton MonoBehavior for Unity3d
using JetBrains.Annotations;
using UnityEngine;
[PublicAPI]
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T>
{
static T _instance;
public static T Instance
{
@TarasOsiris
TarasOsiris / UTSetAndroidBuildSubtarget.cs
Created June 24, 2014 09:57
Set Android Texture Compression uTomate Action
using UnityEditor;
[UTActionInfoAttribute(actionCategory = "Build")]
[UTDoc(title = "Set Android Texture Compression", description = "Sets Android texture Compression.")]
[UTInspectorGroups(groups = new []{ "Player" })]
public class UTSetAndroidBuildSubtarget : UTAction
{
[UTDoc(description = "Android targets, only: The texture compression.")]
[UTInspectorHint(group = "Player", order = 4, required = true)]
@TarasOsiris
TarasOsiris / CustomPlayerPrefs.cs
Created June 20, 2014 09:13
Unity3D PlayerPrefs wrapper to provide saving boolean values.
using UnityEngine;
/// <summary>
/// PlayerPrefs wrapper to provide saving boolean values.
/// </summary>
public static class CustomPlayerPrefs
{
private const int StorageFalse = 0;
private const int StorageTrue = 1;
@TarasOsiris
TarasOsiris / SmoothMoves_SetSpriteColor.cs
Last active August 29, 2015 13:58
Playmaker action to set color of the SmoothMoves.Sprite.
using HutongGames.PlayMaker;
using UnityEngine;
[ActionCategory("SmoothMoves")]
[Tooltip("Sets the sprite color of the Sprite")]
public class SmoothMoves_SetSpriteColor : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(SmoothMoves.Sprite))]
[Tooltip("Game Object to set the color on.")]
@TarasOsiris
TarasOsiris / AndroidIdRetriever.cs
Last active November 22, 2023 13:31
Unity3d method to retrieve device ANDROID_ID constant.
using UnityEngine;
public static class AndroidIdRetriever
{
public static string Retrieve()
{
AndroidJavaClass clsUnity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject objActivity = clsUnity.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject objResolver = objActivity.Call<AndroidJavaObject>("getContentResolver");
AndroidJavaClass clsSecure = new AndroidJavaClass("android.provider.Settings$Secure");
@TarasOsiris
TarasOsiris / .gitignore
Last active August 29, 2015 13:56 — forked from zasadnyy/.gitignore
# =============== #
# Unity generated #
# =============== #
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
#Unity3D Generated File On Crash Reports
sysinfo.txt