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; | |
public class MasterCam : ScriptableObject | |
{ | |
[MenuItem("GameObject/MasterCam/Set all cameras")] | |
static void CopyToAllCameras() | |
{ | |
bool go = EditorUtility.DisplayDialog("MasterCam", "***This operations cannot be undone!***\nThis will copy the current scene's camera settings to every camera in every scene included in Build Settings.", "OK", "Cancel"); | |
if (go) |
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 ShowColliders : MonoBehaviour | |
{ | |
public enum collidertype | |
{ All, TriggersOnly, CollidersOnly, None} | |
public collidertype show = collidertype.All; | |
public Color colliderColor = Color.yellow; | |
public Color triggerColor = Color.blue; |
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 ShowRotated : MonoBehaviour | |
{ | |
public void OnDrawGizmos() | |
{ | |
Gizmos.matrix = transform.localToWorldMatrix; | |
Gizmos.color = Color.blue; | |
Gizmos.DrawLine(Vector3.zero, Vector3.forward * 10f); | |
Gizmos.color = Color.red; |
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; | |
namespace NG | |
{ | |
/// <summary> | |
/// Gets a weighted random number | |
/// Usage | |
/// float y = WeightedRandom.GetRandomValue( | |
/// new WeightedRandom.RandomSelection(100f, 80f , 0.20f), | |
/// new WeightedRandom.RandomSelection(80f, 60f, 0.40f), |
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; | |
/// <summary> | |
/// Simple script to set the playback speed of a particle system on application start | |
/// Allows you to also lock that speed so it can't be changed by another script. | |
/// </summary> | |
[RequireComponent(typeof(ParticleSystem))] | |
public class ParticleSystemSpeed : MonoBehaviour | |
{ |
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 System.IO; | |
using UnityEngine; | |
namespace NG | |
{ | |
public class DebugToFile | |
{ | |
public static List<string> dOut = new List<string>(); |
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; | |
/// <summary> | |
/// Replacement for Unity's debug so we can just shut it off for production | |
/// </summary> | |
public class NGDebug | |
{ | |
private enum WarningLevel | |
{ all, warning, error, none } |
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
#original script by Nikolaus Gradwohl 2012-05-21T05:08:35+02:00 | |
#http://www.local-guru.net/blog/2012/5/21/blender-labyrinth-generator | |
from random import shuffle | |
from array import * | |
import bpy | |
def GetName( cnt ): | |
if (cnt < 100 and cnt > 9): | |
return 'm0' + str(cnt) |
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; // Required for any editor functions | |
using UnityEditor.AnimatedValues; // Required for fade out groups | |
[CustomEditor(typeof(Transform))] // This makes it override the standard inspector for Transforms | |
[CanEditMultipleObjects] // This allows us to select mutiple components and edit them simultaneously | |
// Inherits from Editor class so we can override OnInspectorGUI() | |
// Also note that Editor scripts should always be placed in an "Editor" folder. | |
public class MyTransformComponent : Editor |
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
// This method allows us to add a ShowLocalAxis component to the currently selected transform. | |
// We'll be using a toggle box to add or remove the component. This bool holds that state. | |
private bool showLoxalAxisToggle = false; | |
// This holds a reference to the ShowLocalAxis component. | |
private ShowLocalAxis showLocalAxis; | |
private void ShowLocalAxisComponentToggle() | |
{ | |
// First we check to see if there is a ShowLocalAxis component on this game object. | |
showLocalAxis = _transform.gameObject.GetComponent<ShowLocalAxis>(); |
OlderNewer