Skip to content

Instantly share code, notes, and snippets.

View brunomikoski's full-sized avatar
🛹

Bruno Mikoski brunomikoski

🛹
View GitHub Profile
@brunomikoski
brunomikoski / RidiculousFastBuild.cs
Last active September 18, 2021 15:12
Optimize Android build settings for quick deployment on android
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
namespace BrunoMikoski.Framework.BuildTools
{
public sealed class RidiculousFastBuild : IPostprocessBuildWithReport
{
int IOrderedCallback.callbackOrder => 1000;
@brunomikoski
brunomikoski / AutohookAttribute.cs
Created April 7, 2019 07:38 — forked from LotteMakesStuff/AutohookAttribute.cs
[Autohook] property drawer for unity - Add this [Autohook] attribute to a property to and the inspector will automagically hook up a valid reference for you if it can find a component attached to the same game object that matches the field you put it on. You can watch a demo of this in action here https://youtu.be/faVt09NGzws <3
// NOTE DONT put in an editor folder!
using UnityEngine;
public class AutohookAttribute : PropertyAttribute
{
}
using BrunoMikoski.Pahtfinding.Grid;
using UnityEngine;
namespace BrunoMikoski.Pahtfinding.Fill
{
public sealed class FillController : MonoBehaviour
{
[SerializeField]
private float mimumValueAsBlock = 0.5f;
using UnityEngine;
namespace BrunoMikoski.Pahtfinding.Grid
{
public sealed class GridController : MonoBehaviour
{
[SerializeField]
private int gridSizeX;
public int GridSizeX
{
Vector2 movePos;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(
targetCanvas.transform as RectTransform,
Input.mousePosition, camera,
out movePos))
{
Vector3 mousePos = targetCanvas.transform.TransformPoint(movePos);
cursorRectTransform.position = mousePos;
}
@brunomikoski
brunomikoski / CustomEditorBase.cs
Last active July 23, 2016 22:12 — forked from t0chas/CustomEditorBase.cs
Default Custom Inspector-Editor for Unity3D with ReorderableLists for arrays handling
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEditorInternal;
using UnityEngine;
using Object = UnityEngine.Object;
[CustomEditor(typeof (Object), true, isFallback = true)]
/// <summary>
/// Returns a position on the edge of the screen
/// </summary>
/// <param name="horizontal">0 being left, and 1 being right</param>
/// <param name="vertical">0 being botton, and 1 being top of the screen</param>
/// <param name="horizontalPadding">Padding from the screen, 0 means on screen, and 0.1 will be 10% off the screen</param>
/// <param name="verticalPadding"> </param>
/// <returns></returns>
public Vector3 GetOffScreenPosition(float horizontal,
float vertical,
@brunomikoski
brunomikoski / MonoSingleton.cs
Created December 21, 2015 12:16
Simple MonoSingleton
using UnityEngine;
/// <summary>
/// Mono singleton. From http://wiki.unity3d.com/index.php?title=Singleton#Generic_Based_Singleton_for_MonoBehaviours
/// </summary>
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T>
{
private static T m_Instance = null;
public static T Instance
{
@brunomikoski
brunomikoski / SimplePool.cs
Created December 21, 2015 12:15
Simple pool system for Unity
using UnityEngine;
using System.Collections.Generic;
/// <summary>
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude ([email protected])
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
@brunomikoski
brunomikoski / TriggerVolume.cs
Created September 28, 2015 19:28
General trigger for detecting collisions
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent(typeof(Collider))]
/// <summary>
/// General purpose trigger volume system
///
/// </summary>
/// <author>Bruno Mikoski</author>