Added ReadOnlyOnPlayField Attribute.
This commit is contained in:
parent
518debbf1c
commit
31c51a1b2a
18
Editor/ReadOnlyOnPlayFieldDrawer.cs
Normal file
18
Editor/ReadOnlyOnPlayFieldDrawer.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Runtime;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Utils
|
||||||
|
{
|
||||||
|
[CustomPropertyDrawer(typeof(ReadOnlyOnPlayFieldAttribute))]
|
||||||
|
public class ReadOnlyOnPlayFieldDrawer : PropertyDrawer
|
||||||
|
{
|
||||||
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||||
|
{
|
||||||
|
var state = Application.isPlaying;
|
||||||
|
if (state) GUI.enabled = false;
|
||||||
|
EditorGUI.PropertyField(position, property, label, true);
|
||||||
|
if (state) GUI.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/ReadOnlyOnPlayFieldDrawer.cs.meta
Normal file
3
Editor/ReadOnlyOnPlayFieldDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c45448d04584b318be7490a85ae4681
|
||||||
|
timeCreated: 1657132838
|
6
Runtime/ReadOnlyOnPlayFieldAttribute.cs
Normal file
6
Runtime/ReadOnlyOnPlayFieldAttribute.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Utils
|
||||||
|
{
|
||||||
|
public class ReadOnlyOnPlayFieldAttribute : PropertyAttribute { }
|
||||||
|
}
|
11
Runtime/ReadOnlyOnPlayFieldAttribute.cs.meta
Normal file
11
Runtime/ReadOnlyOnPlayFieldAttribute.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 751004c02d9af6559a8f5c714cf58568
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ru.shazbot.utils",
|
"name": "ru.shazbot.utils",
|
||||||
"version": "4.0.0",
|
"version": "4.1.0",
|
||||||
"displayName": "Utils",
|
"displayName": "Utils",
|
||||||
"description": "Utility useful for almost any project.",
|
"description": "Utility useful for almost any project.",
|
||||||
"licensesUrl": "https://git.shazbot.ru/Utils.git/tree/LICENSE.md",
|
"licensesUrl": "https://git.shazbot.ru/Utils.git/tree/LICENSE.md",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user