Skip to content

Instantly share code, notes, and snippets.

View aomnes's full-sized avatar

Antoine OMNES aomnes

View GitHub Profile
@aomnes
aomnes / getListOnTrigger.js
Last active December 10, 2018 22:01
unity get list on trigger
//Has to go at the top of your file
#pragma strict
import System.Collections.Generic;
//The list of colliders currently inside the trigger
var TriggerList : List.<Collider> = new List.<Collider>();
//called when something enters the trigger
function OnTriggerEnter(other : Collider)
{
@aomnes
aomnes / ReadOnlyAttribute.cs
Created December 14, 2018 13:44
Creat attribute [ReadOnly] with unity editor
using UnityEditor;
using UnityEngine;
public class ReadOnlyAttribute : PropertyAttribute
{
}
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyDrawer : PropertyDrawer
#if UNITY_EDITOR
//-------------------------------------------------------------------------
[UnityEditor.CustomEditor( typeof( UIElement ) )]
public class UIElementEditor : UnityEditor.Editor
{
//-------------------------------------------------
// Custom Inspector GUI allows us to click from within the UI
//-------------------------------------------------
public override void OnInspectorGUI()
{