This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[RequireComponent(typeof(Rigidbody2D))] | |
public class AutoRotator2D : MonoBehaviour | |
{ | |
public enum AutoRotateType | |
{ | |
AddForceEveryFrame, | |
AddTorqueImpulse | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[RequireComponent(typeof(Rigidbody2D))] | |
public class AutoMover2D : MonoBehaviour | |
{ | |
public enum AutoMovementType | |
{ | |
AddForceEveryFrame, | |
AddImpulseForce, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
/// <summary> | |
/// Static References helper using Dictionaries | |
/// | |
/// Why? Eliminate calls to GetComponent and FindObjectOfType and other such calls for objects that you often need to reference. | |
/// Cache them once here, then re-use that reference project-wide | |
/// Singletons won't need this as they store their own static reference | |
/// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEditor; | |
using UnityEngine; | |
public class FindWindow | |
{ | |
[MenuItem("GameObject/Find/Instances of prefab", false, -100)] | |
static void InstancesOfPrefabInScene() | |
{ | |
var selected = Selection.activeGameObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
public class RevertSelectedPrefabs | |
{ | |
[MenuItem("Tools/Revert Selected Prefabs")] | |
static void Execute() | |
{ | |
if (Selection.gameObjects.Length < 1) Debug.Log("No selection to revert."); | |
if (EditorUtility.DisplayDialog("Revert Selected Prefabs?", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEditor; | |
public static class FindEmptyFolders | |
{ | |
[MenuItem("Assets/Find Empty Folders")] | |
static void OnFindEmptyFolders() | |
{ | |
var empties = new List<UnityEngine.Object>(); | |
foreach (var d in System.IO.Directory.GetDirectories("Assets", "*", System.IO.SearchOption.AllDirectories)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using System; | |
using System.Linq; | |
public class SelectionHistoryWindow : EditorWindow | |
{ | |
[MenuItem("Tools/Selection History Window")] | |
[MenuItem("Window/Selection History")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
public class SnapToGround : Editor | |
{ | |
[MenuItem("Tools/Snap Selection To Ground #END")] | |
public static void SnapToGroundNow() | |
{ | |
foreach (Transform t in Selection.transforms) | |
{ | |
Undo.RegisterCompleteObjectUndo(Selection.transforms, "SnapToGroundNow"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Linq; | |
// Original source: http://answers.unity.com/answers/746039/view.html | |
public class CreateMaterialsForTextures : ScriptableWizard | |
{ | |
[MenuItem("Tools/CreateMaterialsForTextures")] | |
static void CreateMaterials() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class ConstantRotation : MonoBehaviour | |
{ | |
public bool randomizeValues; | |
public Vector3 speed = new Vector3(0f, 100f, 0f); | |
public float multiplier = 1; | |
public Vector2 randomMultiplierRange = new Vector2(90f, 120f); | |
void Start() |