mirror of
https://github.com/maxartz15/VolumetricLighting.git
synced 2025-06-16 00:26:10 +02:00
Added the project.
This commit is contained in:
23
Assets/MinValueAttribute/Editor/MinValueDrawer.cs
Normal file
23
Assets/MinValueAttribute/Editor/MinValueDrawer.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomPropertyDrawer (typeof (MinValueAttribute))]
|
||||
public class MinValueDrawer : PropertyDrawer {
|
||||
|
||||
public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (property.propertyType != SerializedPropertyType.Float && property.propertyType != SerializedPropertyType.Integer)
|
||||
{
|
||||
EditorGUI.LabelField (position, label.text, "Use MinValue with float or int.");
|
||||
return;
|
||||
}
|
||||
|
||||
EditorGUI.PropertyField(position, property, label);
|
||||
|
||||
if (GUI.changed)
|
||||
{
|
||||
MinValueAttribute minValue = attribute as MinValueAttribute;
|
||||
property.floatValue = Mathf.Max(property.floatValue, minValue.min);
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/MinValueAttribute/Editor/MinValueDrawer.cs.meta
Normal file
12
Assets/MinValueAttribute/Editor/MinValueDrawer.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af909d555c4764145b02bd06b0c9646d
|
||||
timeCreated: 1447329696
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user