Version: 5.3 (switch to 5.4b)
ЯзыкEnglish
  • C#
  • JS

Язык программирования

Выберите подходящий для вас язык программирования. Все примеры кода будут представлены на выбранном языке.

SerializedProperty

class in UnityEditor

Предложить изменения

Успех!

Благодарим вас за то, что вы помогаете нам улучшить качество документации по Unity. Однако, мы не можем принять любой перевод. Мы проверяем каждый предложенный вами вариант перевода и принимаем его только если он соответствует оригиналу.

Закрыть

Ошибка внесения изменений

По определённым причинам предложенный вами перевод не может быть принят. Пожалуйста <a>попробуйте снова</a> через пару минут. И выражаем вам свою благодарность за то, что вы уделяете время, чтобы улучшить документацию по Unity.

Закрыть

Отменить

Руководство

Описание

SerializedProperty and SerializedObject are classes for editing properties on objects in a completely generic way that automatically handles undo and styling UI for prefabs.

SerializedProperty is used in conjunction with SerializedObject and Editor classes. See Also: SerializedObject class, Editor class.


        
using UnityEngine;
        
public class MyObject : ScriptableObject 
{
  public int myInt = 42;
}

public class SerializedProperty : MonoBehaviour { void Start () { MyObject obj = ScriptableObject.CreateInstance<MyObject>(); SerializedObject serializedObject = new UnityEditor.SerializedObject(obj);

SerializedProperty serializedPropertyMyInt = serializedObject.FindProperty("myInt");

Debug.Log("myInt " + serializedPropertyMyInt.intValue); } }

Переменные

animationCurveValueValue of a animation curve property.
arraySizeThe number of elements in the array. If the SerializedObject contains multiple objects it will return the smallest number of elements. So it is always possible to iterate through the SerializedObject and only get properties found in all objects.
boolValueValue of a boolean property.
boundsValueValue of bounds property.
colorValueValue of a color property.
depthNesting depth of the property. (Read Only)
displayNameNice display name of the property. (Read Only)
doubleValueValue of a float property as a double.
editableIs this property editable? (Read Only)
enumDisplayNamesDisplay-friendly names of enumeration of an enum property.
enumNamesNames of enumeration of an enum property.
enumValueIndexEnum index of an enum property.
floatValueValue of a float property.
hasChildrenDoes it have child properties? (Read Only)
hasMultipleDifferentValuesDoes this property represent multiple different values due to multi-object editing? (Read Only)
hasVisibleChildrenDoes it have visible child properties? (Read Only)
intValueValue of an integer property.
isArrayIs this property an array? (Read Only)
isExpandedIs this property expanded in the inspector?
isInstantiatedPrefabIs property part of a prefab instance? (Read Only)
longValueValue of a integer property as a long.
nameName of the property. (Read Only)
objectReferenceValueValue of an object reference property.
prefabOverrideIs property's value different from the prefab it belongs to?
propertyPathFull path of the property. (Read Only)
propertyTypeType of this property (Read Only).
quaternionValueValue of a quaternion property.
rectValueValue of a rectangle property.
serializedObject SerializedObject this property belongs to (Read Only).
stringValueValue of a string property.
tooltipTooltip of the property. (Read Only)
typeType name of the property. (Read Only)
vector2ValueValue of a 2D vector property.
vector3ValueValue of a 3D vector property.
vector4ValueValue of a 4D vector property.

Открытые функции

ClearArrayRemove all elements from the array.
CopyReturns a copy of the SerializedProperty iterator in its current state. This is useful if you want to keep a reference to the current property but continue with the iteration.
CountInPropertyCount visible children of this property, including this property itself.
CountRemainingCount remaining visible properties.
DeleteArrayElementAtIndexDelete the element at the specified index in the array.
DeleteCommandDeletes the serialized property.
DuplicateCommandDuplicates the serialized property.
FindPropertyRelativeRetrieves the SerializedProperty at a relative path to the current property.
GetArrayElementAtIndexReturns the element at the specified index in the array.
GetEndPropertyRetrieves the SerializedProperty that defines the end range of this property.
GetEnumeratorRetrieves an iterator that allows you to iterator over the current nexting of a serialized property.
InsertArrayElementAtIndexInsert an empty element at the specified index in the array.
MoveArrayElementMove an array element from srcIndex to dstIndex.
NextMove to next property.
NextVisibleMove to next visible property.
ResetMove to first property of the object.

Статические функции

EqualContentsSee if contained serialized properties are equal.