本文整理匯總了C#中UnityEditor.SerializedProperty.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# SerializedProperty.GetType方法的具體用法?C# SerializedProperty.GetType怎麽用?C# SerializedProperty.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEditor.SerializedProperty
的用法示例。
在下文中一共展示了SerializedProperty.GetType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DoLayoutProperty
public bool DoLayoutProperty(SerializedProperty property)
{
if (propIndex.ContainsKey(property.propertyPath) == false)
return false;
// Draw the header
string headerText = string.Format("{0} [{1}]", property.displayName, property.arraySize);
EditorGUILayout.PropertyField(property, new GUIContent(headerText), false);
// Save header rect for handling drag and drop
Rect dropRect = GUILayoutUtility.GetLastRect();
// Draw the reorderable list for the property
if (property.isExpanded)
{
propIndex[property.propertyPath].DoLayoutList();
}
// Handle drag and drop into the header
Event evt = Event.current;
if (evt == null)
return true;
if (evt.type == EventType.dragUpdated || evt.type == EventType.dragPerform)
{
if (dropRect.Contains(evt.mousePosition) == false)
return true;
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
if (evt.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
foreach (Object dragged_object in DragAndDrop.objectReferences)
{
if (dragged_object.GetType() != property.GetType())
continue;
int newIndex = property.arraySize;
property.arraySize++;
SerializedProperty target = property.GetArrayElementAtIndex(newIndex);
target.objectReferenceInstanceIDValue = dragged_object.GetInstanceID();
}
evt.Use();
}
}
return true;
}