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 static class LockComponentEditor | |
{ | |
[MenuItem("CONTEXT/Component/Lock Component")] | |
public static void LockComponent(MenuCommand command) | |
{ | |
Component component = (Component)command.context; | |
component.hideFlags |= HideFlags.NotEditable; |
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 static class EditorUtils | |
{ | |
/// <summary> | |
/// Verify whether it can be converted to the specified component. | |
/// </summary> | |
public static bool CanConvertTo<T>(Object context) where T : 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.Text; | |
public static class JsonFormatter | |
{ | |
private const string Indent = " "; | |
public static string PrettyPrint(string input) | |
{ | |
var output = new StringBuilder(input.Length * 2); | |
char? quote = null; |
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.Rendering.PostProcessing; | |
[ExecuteInEditMode] | |
[RequireComponent(typeof(PostProcessVolume))] | |
public class LocalPostProcessProfile : MonoBehaviour | |
{ | |
[SerializeField, HideInInspector] | |
private PostProcessProfile _profile; |
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; | |
public static class GroupGameObjects | |
{ | |
[MenuItem("Edit/Group Items %g")] | |
public static void GroupSelected() | |
{ | |
if (Selection.gameObjects.Length > 1) |
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; | |
public static class IsNullOrEmptyExtensions | |
{ | |
public static bool IsNullOrEmpty(this string str) | |
{ | |
return string.IsNullOrEmpty(str); | |
} |
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; | |
public static class EditorCoroutineRunner | |
{ | |
private static List<IEnumerator> _coroutineList = new List<IEnumerator>(); | |
static EditorCoroutineRunner() | |
{ |
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 ReadOnlyAttribute : PropertyAttribute | |
{ | |
} |
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 UnityEngine; | |
/// <summary> | |
/// GC friendly coroutine utilities | |
/// @JfranMora #UnityTips | |
/// </summary> | |
public static class CoroutineUtils | |
{ | |
public static IEnumerator WaitForSeconds(float seconds) |
NewerOlder