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; | |
using UnityEditor; | |
using UnityEngine; | |
using UnityEngine.UI; | |
/// <summary> | |
/// Replaces the SpriteRenderer with an Image component when a Sprite asset is dragged under a Canvas | |
/// </summary> | |
[InitializeOnLoad] | |
public static class ImageByDefault |
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
public static class Time { | |
public static bool unscaleDeltaTime; | |
// The time this frame has started (RO). This is the time in seconds since the start of the game. | |
public static float time { get { return UnityEngine.Time.time; } } | |
// The time this frame has started (RO). This is the time in seconds since the last level has been loaded. | |
public static float timeSinceLevelLoad { get { return UnityEngine.Time.timeSinceLevelLoad; } } |
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
public static class Time { | |
public static bool unscaleDeltaTime; | |
// The time this frame has started (RO). This is the time in seconds since the start of the game. | |
public static float time { get { return UnityEngine.Time.time; } } | |
// The time this frame has started (RO). This is the time in seconds since the last level has been loaded. | |
public static float timeSinceLevelLoad { get { return UnityEngine.Time.timeSinceLevelLoad; } } |
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 UnityEngine.UI; | |
public class HexGridLayout : LayoutGroup { | |
const float SQUARE_ROOT_OF_3 = 1.73205f; | |
public enum Axis { Horizontal = 0, Vertical = 1 } | |
public enum Constraint { Flexible = 0, FixedColumnCount = 1, FixedRowCount = 2 } |
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; | |
public static class ActionExtensions { | |
public static void SafeInvoke(this Action action) { | |
if (action != null) { | |
action(); | |
} | |
} |
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 UnityEngine.Animations; | |
using UnityEngine.Playables; | |
public class PlayAutomatically : MonoBehaviour { | |
[SerializeField] | |
AnimationClip modelAnimationClip; | |
PlayableGraph playableGraph; |
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
public static class FloatRemapExtension { | |
public static float Remap(this float value, float min, float max, float fromMin = 0, float fromMax = 1) { | |
return ((value - fromMin) / (fromMax - fromMin)) * (max - min) + min; | |
} | |
} |
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; | |
using UnityEngine; | |
public class OnDestroyCallback : MonoBehaviour { | |
Action onDestroy; | |
public static void AddOnDestroyCallback(GameObject gameObject, Action callback) { | |
OnDestroyCallback onDestroyCallback = gameObject.GetComponent<OnDestroyCallback>(); | |
if (!onDestroyCallback) { |
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; | |
using System.Collections.Generic; | |
using UnityEditor; | |
using UnityEngine; | |
public class CopyTransformPositions : EditorWindow { | |
public Transform sourceRoot; | |
public Transform targetRoot; |
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 AutoNameAnimations : AssetPostprocessor { | |
static readonly string[] renameMatches = new string[] { "Take 001", "mixamo.com" }; | |
void OnPostprocessModel(GameObject gameObject) { | |
ModelImporter importer = assetImporter as ModelImporter; |
NewerOlder