Skip to content

Instantly share code, notes, and snippets.

@col000r
col000r / CreateEmptyParented.cs
Last active August 29, 2015 13:57
Drop this into the Editor folder. Press Shift+Cmd/Ctrl+Alt+N to create a new GameObject that is parented to the currently selected Object. Press Cmd/Ctrl+G to group the selected GameObject into a new GameObject.
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class CreateEmptyParented : EditorWindow {
[MenuItem("GameObject/Create Empty (Parented to Selection) %&#n", false, -1)]
static void CreateEmptyParentedNow() {
List<Object> creations = new List<Object>();
@col000r
col000r / PlayModeSwitch.cs
Last active August 29, 2015 13:57
Unity3D: Automatic Layout-switching whenever you enter/exit play-mode!
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
class PlayModeSwitch : EditorWindow {
static bool lastValue = false;
static PlayModeSwitch () {
if(!EditorPrefs.GetBool("AutoSwitchToggle", false)) return; //Check if feature is enabled
@col000r
col000r / README.md
Last active August 29, 2015 13:57
Unity3D + Triton Ocean + Inno Setup = Installer

Inno Setup script for a Unity Project using Triton Ocean

This script creates an installer that puts everything Triton Ocean needs to function in the correct place and then installs the Visual C++ 2010 SP1 runtime libraries as well as the latest DirectX runtime libraries.

The script automatically checks if the correct version of the Visual C++ runtime is already installed and skips that step if it is (No thanks to me, I got the code from StackOverflow)

The DirectX runtime installer is always run. If you happen to know how to make a check and skip this step if it's not necessary, I'd love to know! (Especially since the DirectX web setup needs an online connection and installs their bing-bar bloatware on your PC unless you uncheck the box...)

Prerequisites

@col000r
col000r / AnimationCurveOutput.cs
Created April 1, 2014 11:30
#Unity3D Output all the AnimationCurves found on the current selection to the console, nicely formatted so they can simply be copy/pasted into your script! Introspection, baby!
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
public class AnimationCurveOutput : EditorWindow {
[MenuItem("Assets/Log AnimationCurves")]
public static void LogAnimCurves() {
//Get selection
@col000r
col000r / DrawLineAATest.cs
Created May 13, 2014 13:23
A translation of the code found on wikipedia to C# for use in the unity editor. (I used this to draw lines on a texture, then saved the texture as a PNG...)
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class DrawLineAATest : EditorWindow {
private Texture2D tex;
//http://en.wikipedia.org/wiki/Xiaolin_Wu's_line_algorithm
@col000r
col000r / CameraLookAt.cs
Created July 8, 2014 16:36
Make a camera look at an object, make it smoothly follow its path, and don't jerk-turn around when it moves beyond 0 or 360 degrees, dammit.
using UnityEngine;
using System.Collections;
/// <summary>
/// Put this script on a camera, assign a target and the camera will always look at that target, smoothly following it.
/// </summary>
public class CameraLookAt : MonoBehaviour {
public Transform target; //Look at this
private Transform aimTarget;
@col000r
col000r / PingTest.cs
Created September 8, 2014 21:25
MORILD is looking for freelancers! Show me you can code by completing this little script!
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PingTest : MonoBehaviour {
public List<string> urls = new List<string>() { "google.com", "http://altavista.com", "https://github.com/explore", "maps.google.com" };
void Start () {
@col000r
col000r / package.json
Last active January 8, 2019 04:13
package with dependencies
{
"name": "com.company.yourpackage",
"displayName": "Your Package's Name",
"version": "1.0.0",
"unity": "2018.3",
"description": "The description of your package",
"keywords": [ "package", "unity", "yeah" ],
"dependencies": {
"com.company.otherpackage": "1.0.5",
"com.company.thirdpackage": "2.1.0"
@col000r
col000r / package.json
Last active January 8, 2019 04:13
package.json
{
"name": "com.company.yourpackage",
"displayName": "Your Package's Name",
"version": "1.0.0",
"unity": "2018.3",
"description": "The description of your package",
"keywords": [ "package", "unity", "yeah" ],
"dependencies": {}
}
@col000r
col000r / manifest.json
Created February 11, 2019 02:33
How to add scope registries to your package manifest
{
"scopedRegistries": [
{
"name": "Tools",
"url": "http://34.247.102.143:4873/",
"scopes": [
"at.blackish"
]
}
],