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 System.Collections; | |
| // taken from https://answers.unity.com/questions/1189736/im-trying-to-shuffle-an-arrays-order.html | |
| public class DeckShuffle : MonoBehaviour { | |
| public GameObject[] decklist; | |
| private GameObject tempGO; | |
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
| // Not support of 2019.1.0f1 | |
| static void CreateScriptAsset(string templatePath, string destName) { | |
| #if UNITY_2019_1_OR_NEWER | |
| UnityEditor.ProjectWindowUtil.CreateScriptAssetFromTemplateFile(templatePath, destName); | |
| #else | |
| typeof(UnityEditor.ProjectWindowUtil) | |
| .GetMethod("CreateScriptAsset", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic) | |
| .Invoke(null, new object[] { templatePath, destName }); | |
| #endif |
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; | |
| // TODO: rename to 'secret quit button' xD | |
| // Maybe just have a "Sure to quit?" window? | |
| [InitializeOnLoad] | |
| public class AccidentalProjectClosePrevention | |
| { | |
| [MenuItem("Tools/Quit")] |
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
| #if UNITY_EDITOR | |
| // Author: Siarhei Pilat (Suasor AB) | |
| // License: MIT | |
| // Last updated: 02-11-2021 | |
| using UnityEditor; | |
| using UnityEngine; | |
| [InitializeOnLoad] |
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
| // credit goes to: Game Dev Guide | |
| // original: https://www.youtube.com/watch?v=CGsEJToeXmA&ab_channel=GameDevGuide | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.UI; | |
| public class FlexibleGridLayout : LayoutGroup | |
| { |
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
| // taken from: https://forum.unity.com/threads/change-gameobject-layer-at-run-time-wont-apply-to-child.10091/ | |
| // special thanks to: chadfranklin47 | |
| public static class ExtensionMethods | |
| { | |
| public static void SetLayerRecursively(this Transform parent, int layer) | |
| { | |
| parent.gameObject.layer = layer; | |
| for (int i = 0, count = parent.childCount; i < count; i++) |
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
| #if UNITY_EDITOR | |
| using UnityEditor; | |
| using UnityEngine; | |
| using UnityEditor.SceneManagement; | |
| [InitializeOnLoad] | |
| public class SceneNameDisplay | |
| { | |
| [MenuItem("Tools/Scene name toggle &r")] |
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
| class SciptableObjectValueSetter { | |
| // 'Mechanic' is a ScriptableObject | |
| var so = (Mechanic)AssetDatabase.LoadAssetAtPath("Assets/SOs/Abilities.asset", typeof(Mechanic)); | |
| so.SomeValue = "boop"; | |
| // And this ensures that the value is saved not only in the inspector and also survives all kinds of reloads! | |
| EditorUtility.SetDirty(so); | |
| AssetDatabase.SaveAssets(); |
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 UnityEditor.EditorTools; | |
| [EditorTool("Prefab Painter 2D")] | |
| public class PrefabPainter2D : EditorTool | |
| { | |
| float DiscRadius; | |
| public override void OnToolGUI(EditorWindow window) |
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
| #if UNITY_EDITOR | |
| using UnityEngine; | |
| using UnityEditor; | |
| [InitializeOnLoad] | |
| public static class NewObjectBottomOfHierarchy | |
| { | |
| static NewObjectBottomOfHierarchy() | |
| { |