This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
public static class SerializedObjectUtility | |
{ | |
public static object GetTargetValue(this SerializedProperty property) | |
{ | |
var targetObject = property.serializedObject.targetObject; | |
var field = targetObject.GetType().GetField(property.propertyPath); | |
return field?.GetValue(targetObject); |
OlderNewer