Skip to content

Instantly share code, notes, and snippets.

View MarshMello0's full-sized avatar
⚙️
Modding at vtolvr-mods.com

Marsh MarshMello0

⚙️
Modding at vtolvr-mods.com
View GitHub Profile
@MarshMello0
MarshMello0 / Checking method time.cs
Created April 14, 2019 12:35
[Unity] A easy way to check which functions are taking the longest without having to rip apart your code to place check
private bool _busy = false;
public void TimeCheck(Action callback)
{
if (!_busy)
{
_busy = true;
DateTime before = DateTime.Now;
callback.Invoke();
DateTime after = DateTime.Now;
TimeSpan duration = after.Subtract(before);
@MarshMello0
MarshMello0 / SimpleCameraController.cs
Created March 28, 2019 15:06
This is the SimpleCameraController from the UnityTemplateProjects, I did not change any of it, just placed it here so I can find it easier for future projects
using UnityEngine;
namespace UnityTemplateProjects
{
public class SimpleCameraController : MonoBehaviour
{
class CameraState
{
public float yaw;
public float pitch;
@MarshMello0
MarshMello0 / TMPMatchSize.cs
Created February 26, 2019 13:51
[Unity TextMeshProUGUI] Sets all of the TextMeshProUGUI sizes to the same size
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class TMPMatchSize : MonoBehaviour
{
[Header("Settings")]
[Tooltip("This is the size of what you want all of the texts to be set to.")]
public float targetSize;
@MarshMello0
MarshMello0 / ScaleableGridContent.cs
Last active February 26, 2019 13:51
[Unity] Scales the GridLayoutGroup to an even amount depending of how many rows and cols you want
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(GridLayoutGroup), typeof(RectTransform))]
public class ScaleableGridContent : MonoBehaviour
{
[Header("Settings")]