Skip to content

Instantly share code, notes, and snippets.

View Westerveld's full-sized avatar

Ethan Bruins Westerveld

View GitHub Profile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
using TMPro;
using System.Text.RegularExpressions;
public class ButtonNameToText : EditorWindow
{
@Westerveld
Westerveld / SetColliderSizeFromScale.cs
Last active April 12, 2019 01:07
This can be used in unity to convert the scale of the object to be the size of its collider. Note: it does also remove the mesh and resets the scale of the object
// Ethan Bruins 2019
// https://gist.github.com/Westerveld/fc81c4f51846c7153df8715fe5b76ddd
using UnityEngine;
using UnityEditor;
public class SetColliderSizeFromScale : EditorWindow
{
//Shows up in the hierachy when placed in the GameObject menu
[MenuItem("GameObject/Convert Scale To Collider", false, 0)]
@Westerveld
Westerveld / PeopleGen.cs
Last active March 15, 2019 16:31
A couple of scripts to use in Unity to create procedural people and text as shown at https://thisisverypointless.itch.io/procpeeps
using UnityEngine;
public class PeopleGen : MonoBehaviour
{
[SerializeField]
Sprite[] eyes;
[SerializeField]
Sprite[] hair;
[SerializeField]
Sprite[] mouth;
@Westerveld
Westerveld / MiningController.cs
Last active April 17, 2018 12:45
This script can destroy tilemap blocks via raycasting
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class MiningController : MonoBehaviour {
public float castDistance = 1.0f; //How far we will cast
public Transform raycastPoint; //The origin point of our cast