This commit is contained in:
Gerard Gascón 2025-04-24 17:19:36 +02:00
commit 001bb14f16
951 changed files with 270074 additions and 0 deletions

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4be9f6fb652f19488b46fbc9bac8be5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b58f02022de16354ba42b835bcc79d57
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,81 @@
using UnityEngine;
using UnityEditor;
using Geri.MinMaxSlider;
[CustomPropertyDrawer(typeof(MinMaxSliderAttribute))]
public class MinMaxSliderDrawer : PropertyDrawer {
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label){
var minMaxAttribute = (MinMaxSliderAttribute)attribute;
var propertyType = property.propertyType;
label.tooltip = minMaxAttribute.min.ToString("F2") + " to " + minMaxAttribute.max.ToString("F2");
if(propertyType == SerializedPropertyType.Vector2){
Vector2 vector = property.vector2Value;
float minVal = vector.x;
float maxVal = vector.y;
int originalIndentLevel = EditorGUI.indentLevel;
EditorGUI.BeginProperty(position, label, property);
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
EditorGUI.indentLevel = 0;
float fieldWidth = position.width / 4f - 4f;
float sliderWidth = position.width / 2f;
position.width = fieldWidth;
minVal = EditorGUI.FloatField(position, minVal);
position.x += fieldWidth + 4f;
position.width = sliderWidth;
EditorGUI.MinMaxSlider(position, ref minVal, ref maxVal, minMaxAttribute.min, minMaxAttribute.max);
position.x += sliderWidth + 4f;
position.width = fieldWidth;
maxVal = EditorGUI.FloatField(position, maxVal);
if (maxVal < minMaxAttribute.min){
minVal = minMaxAttribute.min;
}else if (maxVal > minMaxAttribute.max){
maxVal = minMaxAttribute.max;
}
vector = new Vector2(minVal > maxVal ? maxVal : minVal, maxVal);
property.vector2Value = vector;
EditorGUI.EndProperty();
EditorGUI.indentLevel = originalIndentLevel;
}else if(propertyType == SerializedPropertyType.Vector2Int){
Vector2Int vector = property.vector2IntValue;
float minVal = vector.x;
float maxVal = vector.y;
int originalIndentLevel = EditorGUI.indentLevel;
EditorGUI.BeginProperty(position, label, property);
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
EditorGUI.indentLevel = 0;
float fieldWidth = position.width / 4f - 4f;
float sliderWidth = position.width / 2f;
position.width = fieldWidth;
minVal = EditorGUI.FloatField(position, minVal);
position.x += fieldWidth + 4f;
position.width = sliderWidth;
EditorGUI.MinMaxSlider(position, ref minVal, ref maxVal, minMaxAttribute.min, minMaxAttribute.max);
position.x += sliderWidth + 4f;
position.width = fieldWidth;
maxVal = EditorGUI.FloatField(position, maxVal);
if (maxVal < minMaxAttribute.min){
minVal = minMaxAttribute.min;
}else if (maxVal > minMaxAttribute.max){
maxVal = minMaxAttribute.max;
}
vector = new Vector2Int(Mathf.FloorToInt(minVal > maxVal ? maxVal : minVal), Mathf.FloorToInt(maxVal));
property.vector2IntValue = vector;
EditorGUI.EndProperty();
EditorGUI.indentLevel = originalIndentLevel;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e6b53f69308943e499e344adc5adee79
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,16 @@
namespace Geri.MinMaxSlider
{
using UnityEngine;
public class MinMaxSliderAttribute : PropertyAttribute{
public float min;
public float max;
public MinMaxSliderAttribute(float min, float max)
{
this.min = min;
this.max = max;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a090d8b694abe7141af9c000b8cf42ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Tools/SimpleMinMaxSlider/Square.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,102 @@
fileFormatVersion: 2
guid: d93624141d1826749b7f50e692cc2a93
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 3
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 4
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline:
- - {x: -2, y: -2}
- {x: -2, y: 2}
- {x: 2, y: 2}
- {x: 2, y: -2}
physicsShape:
- - {x: -2, y: -2}
- {x: -2, y: 2}
- {x: 2, y: 2}
- {x: 2, y: -2}
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: