Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
I may be slow to respond.

litefeel litefeel

🎯
I may be slow to respond.
View GitHub Profile
@LotteMakesStuff
LotteMakesStuff / PhysicsTool.cs
Created Aug 26, 2019
In Unity 2019.1 Unity added a new custom EditorTool API, heres some example code showing some tools we could make with it!
View PhysicsTool.cs
// Put me in an editor folder!
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;
[EditorTool("PhysicsDrop Tool", typeof(Rigidbody))]
public class PhysicsTool : EditorTool
@FreyaHolmer
FreyaHolmer / LengthTable.cs
Created Aug 21, 2019
Béziér curve utility class for converting a t value to percentage of distance along the spline
View LengthTable.cs
using UnityEngine;
public class LengthTable {
public float[] distances;
int SmpCount => distances.Length;
float TotalLength => distances[SmpCount - 1];
public LengthTable( OrientedCubicBezier3D bezier, int precision = 16 ) {
distances = new float[precision];
@LotteMakesStuff
LotteMakesStuff / AutohookAttribute.cs
Last active Jul 17, 2020
[Autohook] property drawer for unity - Add this [Autohook] attribute to a property to and the inspector will automagically hook up a valid reference for you if it can find a component attached to the same game object that matches the field you put it on. You can watch a demo of this in action here https://youtu.be/faVt09NGzws <3
View AutohookAttribute.cs
// NOTE DONT put in an editor folder!
using UnityEngine;
public class AutohookAttribute : PropertyAttribute
{
}
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active Jul 17, 2020
UPM: How to make a custom package
View 1.md

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@gekidoslair
gekidoslair / ResourceChecker.cs
Last active Jan 30, 2020
Gives you a list of resources (objects, materials, textures) used in a scene, super helpful for optimizing scenes (mobile etc) - updated for 2019.x
View ResourceChecker.cs
// Resource Checker
// (c) 2012 Simon Oliver / HandCircus / hello@handcircus.com
// (c) 2015 Brice Clocher / Mangatome / hello@mangatome.net
// Public domain, do with whatever you like, commercial or not
// This comes with no warranty, use at your own risk!
// https://github.com/handcircus/Unity-Resource-Checker
using System;
using System.Linq;
using UnityEngine;
@Pulimet
Pulimet / AdbCommands
Last active Aug 15, 2020
Adb useful commands list
View AdbCommands
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@keijiro
keijiro / PbxModifier.cs
Created Jul 2, 2015
(Unity Xcode Manipulation API) An example which modifies compiler flags for a given source file.
View PbxModifier.cs
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System.IO;
public class PbxModifier
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
@bzgeb
bzgeb / TriggerContainerEditor.cs
Created Sep 28, 2012
Example Drag & Drop area in a custom inspector for the Unity editor
View TriggerContainerEditor.cs
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor (typeof(TriggerContainer))]
public class TriggerContainerEditor : Editor
{
private SerializedObject obj;
You can’t perform that action at this time.