I am not sure what you mean by “none of script input position and structure, name.”
The C# version is almost the same as the UnityScript which is demonstrated
I have not tested the following, but I have converted one of the simpler examples from UnityScript to C# for you. I hope that this helps
// Assets/Scripts/RangeAttribute.cs
using UnityEngine;
public class RangeAttribute : PropertyAttribute {
public float min;
public float max;
public RangeAttribute (float min, float max) {
this.min = min;
this.max = max;
}
}
// Assets/Scripts/Editor/RangeDrawer.cs
using UnityEngine;
using UnityEditor;
// The property drawer class should be placed in an editor script, inside a folder called Editor.
// Tell the RangeDrawer that it is a drawer for properties with the RangeAttribute.
[CustomPropertyDrawer (typeof(RangeAttribute))]
public class RangeDrawer : PropertyDrawer {
// Draw the property inside the given rect
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
// First get the attribute since it contains the range for the slider
RangeAttribute range = attribute as RangeAttribute;
// Now draw the property as a Slider or an IntSlider based on whether it's a float or integer.
if (property.propertyType == SerializedPropertyType.Float)
EditorGUI.Slider (position, property, range.min, range.max, label);
else if (property.propertyType == SerializedPropertyType.Integer)
EditorGUI.IntSlider (position, property, range.min, range.max, label);
else
EditorGUI.LabelField (position, label.text, "Use Range with float or int.");
}
}
// Assets/Scripts/CustomBehaviour.cs
using UnityEngine;
public class CustomBehaviour : MonoBehaviour {
[Range(0f, 10f)]
public float someRange;
}