Skip to content

Instantly share code, notes, and snippets.

View acoppes's full-sized avatar

Ariel Coppes acoppes

View GitHub Profile
View RandomAnimalNameGeneratorService.cs
public class RandomAnimalNameGeneratorService : MonoBehaviour
{
[FormerlySerializedAs("colorsTextAsset")]
public TextAsset firstNameTextAsset;
[FormerlySerializedAs("adjectivesTextAsset")]
public TextAsset secondNameTextAsset;
[FormerlySerializedAs("namesTextAsset")]
public TextAsset thirdNameTextAsset;
@acoppes
acoppes / TypeValidationAttribute.cs
Created December 30, 2022 19:57
Useful to validate if references to Object or GameObject match specific type in Unity
View TypeValidationAttribute.cs
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class)]
public class TypeValidationAttribute : PropertyAttribute
{
public Type typeToValidate;
public TypeValidationAttribute(Type typeToValidate)
{
this.typeToValidate = typeToValidate;
}
}
@acoppes
acoppes / RefactorTools.cs
Last active April 30, 2022 09:33
Unity Editor helper methods to Refactor Data stored in Prefabs, Scenes and other Assets
View RefactorTools.cs
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
namespace Utils.Editor
{
public static class RefactorTools
@acoppes
acoppes / OptionalFieldsPropertyDrawer.cs
Created April 9, 2021 01:37
Just a Untiy prop drawer for optonal fields
View OptionalFieldsPropertyDrawer.cs
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Gemserk.Utils
{
[CustomPropertyDrawer(typeof(OptionalFieldsAttribute))]
public class OptionalFieldsPropertyDrawer : PropertyDrawer
{
@acoppes
acoppes / AssetDatabaseExt.cs
Last active July 10, 2023 12:45
Unity Editor helper methods to get Prefabs with one or more specific components from the assets database.
View AssetDatabaseExt.cs
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Utils.Editor
{
public static class AssetDatabaseExt
{
View DynamicObstaclesSystem.cs
using NaiveNetworkGame.Server.Components;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
namespace NaiveNetworkGame.Server.Systems
{
[UpdateAfter(typeof(MovementActionSystem))]
[UpdateInGroup(typeof(ServerSimulationSystemGroup))]
@acoppes
acoppes / UnityEditorTests.cs
Created April 10, 2019 11:09
Playing with unity editor
View UnityEditorTests.cs
using UnityEditor;
using UnityEngine;
[ExecuteInEditMode]
public class TestEditor : MonoBehaviour
{
public UnityEngine.Object prefab;
public GameObject parent;
@acoppes
acoppes / readme.txt
Created December 11, 2018 17:45
Dicey Dices (PuzzleScript Script)
View readme.txt
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@acoppes
acoppes / CreateCustomEditorAction.cs
Created October 21, 2018 20:03
Unity menu action to create an empty Editor for the selected MonoScript
View CreateCustomEditorAction.cs
using UnityEditor;
using System.Text;
using System.IO;
public static class CreateCustomEditorAction
{
[MenuItem("Assets/Create/Custom Editor from Script", true)]
public static bool CreateCustomInspectorValidator()
{
return Selection.activeObject is MonoScript;
@acoppes
acoppes / gist:2eb9e769c192206984c7fec8ee0676b0
Created January 21, 2017 23:32
bomberdota input config
View gist:2eb9e769c192206984c7fec8ee0676b0
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!13 &1
InputManager:
m_ObjectHideFlags: 0
m_Axes:
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName: