Skip to content

Instantly share code, notes, and snippets.

View liortal53's full-sized avatar

Lior Tal liortal53

View GitHub Profile
@liortal53
liortal53 / ActionExtensions.cs
Created October 21, 2023 18:35
Example demonstrating how to safely invoke all delegates in a System.Action while catching exceptions
using System;
namespace Extensions.Utils
{
public static class ActionExtensions
{
/// <summary>
/// Safe invocation of all delegates stored in the passed <see cref="Action"/> delegate.
/// </summary>
public static void InvokeSafe(this Action action)
@liortal53
liortal53 / EnumExtensionsExample.cs
Created September 16, 2022 06:01
EnumExtensions Example
using System;
using System.Linq;
[Flags]
public enum Enemy
{
None = 0,
Goblin = 1,
Wizard = 2,
Dragon = 4
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEditor.TestTools.TestRunner.Api;
using UnityEngine;
using UnityEngine.TestTools;
namespace UnityTestExtensions
{
/// <summary>
@liortal53
liortal53 / EmbedPackage.cs
Created October 25, 2019 07:19
Embed package into your Unity project to modify the code more easily :)
using System.IO;
using UnityEditor.PackageManager;
using UnityEngine;
namespace UnityEditor.Extensions
{
#if UNITY_2017_3_OR_NEWER
/// <summary>
/// Editor extension for embedding packages as a local copy in the project.
using System.IO;
using UnityEditor.PackageManager;
using UnityEngine;
namespace UnityEditor.Extensions
{
#if UNITY_2017_3_OR_NEWER
/// <summary>
/// Editor extension for embedding packages as a local copy in the project.
using System.IO;
using UnityEditor.PackageManager;
using UnityEngine;
namespace UnityEditor.Extensions
{
/// <summary>
/// Editor extension for embedding packages as a local copy in the project.
/// This can be useful in case you want to modify the package's source code.
/// </summary>
@liortal53
liortal53 / Deadlock.txt
Created June 8, 2016 10:07
Android thread dump of a deadlock in Facebook Android SDK (AppEventsLogger)
1 12139 Runnable 949 378 main
at com.unity3d.player.UnityPlayer.UnitySendMessage(Native Method)
at com.androidnative.AndroidNativeBridge.onStop(AndroidNativeBridge.java:186)
at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1278)
at android.app.Activity.performStop(Activity.java:6395)
at android.app.ActivityThread.handleSleeping(ActivityThread.java:3621)
at android.app.ActivityThread.-wrap19(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1519)
at android.os.Handler.dispatchMessage(Handler.java:102)
@liortal53
liortal53 / PostBuildHelper.cs
Created January 28, 2016 08:48
Unity: Auto increment iOS build number post build
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEngine;
public static class PostBuildHelper
{
[PostProcessBuild]
@liortal53
liortal53 / ConsoleRouter.cs
Last active December 25, 2020 03:41
Redirect Console output to Unity's console
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
public class ConsoleWriter : TextWriter
{
public override void Write(char value)
{
}
@liortal53
liortal53 / UnityEngineDocsRemover.cs
Created September 13, 2015 08:48
Workaround for removing UnityEngine.xml that is included for iOS builds
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
/// <summary>
/// Helper class for removing UnityEngine.xml that is included in iOS builds (bug)
/// </summary>
public static class UnityEngineDocsRemover
{
[PostProcessBuild]