This file contains 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; | |
// @kurtdekker | |
// | |
// For stopping your game during instantiated / enabled dialogs. | |
// | |
// To use: put this script on things that you want to | |
// stop your game action when they appear, like dialogs. | |
// | |
// You only need one instance of this script per dialog. |
This file contains 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; | |
// @kurtdekker | |
// Make sure this is in an Editor folder! | |
public static class DuplicationHelpers | |
{ | |
// duplicates the current object and puts it back right after the original. | |
[MenuItem( "Assets/Dupe Here FFS")] |
This file contains 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; | |
// @kurtdekker | |
// Place on a GameObject, set the desired rate of spin | |
public class SpinOnY : MonoBehaviour | |
{ | |
[Header( "Degrees per second.")] | |
public float RateOfRotation = 200.0f; |
This file contains 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 CallWhenTrue : MonoBehaviour | |
{ | |
System.Func<bool> test; | |
System.Action action; | |
public static CallWhenTrue Create( System.Func<bool> test, System.Action action) | |
{ | |
CallWhenTrue cwt = new GameObject("CallWhenTrue").AddComponent<CallWhenTrue>(); |
This file contains 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; | |
// @kurtdekker | |
public static class GeometryHelpers | |
{ | |
public static void ApplyMeshScaling( GameObject go, float scale) | |
{ | |
var MeshFilters = go.GetComponentsInChildren<MeshFilter>(); |
This file contains 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 System.Collections; | |
using UnityEditor; | |
// @kurtdekker | |
// You must put this in an Editor folder! | |
// Once compiled, you must run it from Menu -> Assets -> ReadInputManager | |
public class ReadInputManager |
This file contains 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; | |
// @kurtdekker | |
// Ultra-simple clean stateless in-game pause/unpause mechanism. | |
// TODO: | |
// - put one of these script instances in your running game scene | |
// - be sure to set Time.timeScale = 1 when your game starts | |
public class InGamePause : MonoBehaviour | |
{ |
This file contains 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 UnityEngine.EventSystems; | |
// @kurtdekker | |
// cheap and cheerful "increase the size of the focused button" | |
public class ScaleOnFocus : MonoBehaviour | |
{ | |
[Header( "Percent increase +10%, etc.")] | |
public float PercentIncrease = 10; |
This file contains 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; | |
// @kurtdekker | |
// Purpose: follows another Transform, maintaining the same offset from it. | |
// Useful for a detached health bar that follows a rotating ship (for instance). | |
public class LateFollow : MonoBehaviour | |
{ | |
public Transform TargetToFollow; | |
Vector3 Offset; |
This file contains 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; | |
// @kurtdekker | |
// cheap and cheerful grid-of-sprites maker | |
// this is an editor-time application | |
// it assumes you will further manipulate this grid and DIRTY AND SAVE THE SCENE | |
// be sure to drop this into an Editor folder! | |
public class MakeGridOfSprites : EditorWindow |