Skip to content

Instantly share code, notes, and snippets.

@haim96
haim96 / PlayerAnimator.cs
Created July 10, 2022 12:04 — forked from Matthew-J-Spencer/PlayerAnimator.cs
Control unity animations using code. Video: https://youtu.be/ZwLekxsSY3Y
using System;
using UnityEngine;
using UnityEngine.Tilemaps;
using Random = UnityEngine.Random;
public class PlayerAnimator : MonoBehaviour {
[SerializeField] private float _minImpactForce = 20;
// Anim times can be gathered from the state itself, but
// for the simplicity of the video...
@unitycoder
unitycoder / UnityPackage not importing to active unity
Last active April 3, 2023 09:40
Fix .UnityPackage for Opening into Currently Running Editor (instead of opening new Unity Instance)
- If you installed 32bit unity, and then removed it, it doesnt work
- install 5.6 64 bit to fix
or use registry fix below, IMPORTANT, insert some unity editor path there
@benshippee
benshippee / BuildNumberIncrementer.cs
Created February 11, 2020 01:37
Unity build post process script to automatically bump iOS and Android version numbers
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
public class BuildNumberIncrementer
{
[PostProcessBuild]
public static void OnBuildComplete(BuildTarget buildTarget, string pathToBuiltProject)
@ditzel
ditzel / MeshDestroy.cs
Created August 19, 2019 19:02
MeshDestroy => Put it on a game object with a mesh filter and renderer. Make sure to have read/write enabled on fbx import
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshDestroy : MonoBehaviour
{
private bool edgeSet = false;
private Vector3 edgeVertex = Vector3.zero;
private Vector2 edgeUV = Vector2.zero;
@LotteMakesStuff
LotteMakesStuff / LayoutUtils.cs
Last active November 2, 2023 21:04
Simple tool for importing editor layout files (.wlt files) from the asset folder. this is cool cos you can then share layouts with your team via source control
// put me in an Editor folder
using System.IO;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
public static class LayoutUtils
{
// unity stores layouts in a path referenced in WindowLayout.LayoutsPreferencesPath.
// Unfortunately, thats internal - well just creat the path in the same way they do!
@willchis
willchis / gist:9e14a49df26034d60141586308084d65
Last active December 7, 2020 19:40
Google Sheets API and Service Account
public class SpreadSheetConnector {
private string[] _scopes = { SheetsService.Scope.Spreadsheets }; // Change this if you're accessing Drive or Docs
private string _applicationName = "My Application Name from Google API Project ";
private string _spreadsheetId = "xdMsqBc3wblahblahblahblahkeygoeshere";
private SheetsService _sheetsService;
private void ConnectToGoogle() {
GoogleCredential credential;
anonymous
anonymous / PlayerPrefsTools.cs
Created March 13, 2018 08:08
Get all player prefs keys (windows only)
using System.Collections.Generic;
public class PlayerPrefsTools
{
public static void GetAllPlayerPrefKeys(ref List<string> keys)
{
if (keys != null)
{
keys.Clear();
}
using UnityEngine;
using UnityEngine.EventSystems;
public class FixedButton : MonoBehaviour, IPointerUpHandler, IPointerDownHandler
{
[HideInInspector]
public bool Pressed;
// Use this for initialization
void Start()
@paullj
paullj / JSONEditor.cs
Last active October 16, 2020 08:57
A JSON Editor in the inspector. Preview and more information in comments 🙂
using System.IO;
using System.Linq;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
public class PoolPreparer : MonoBehaviour
{
[SerializeField]
PooledMonobehaviour[] prefabs;