This repository has been archived on 2025-06-25. You can view files and clone it, but cannot push or open issues or pull requests.
Net.Like.Xue.Tokyo/Assets/BITKit/Unity/Scripts/Object/ObjectExtensions.cs

24 lines
503 B
C#
Raw Normal View History

2024-11-03 16:42:23 +08:00
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
namespace BITKit
{
public static partial class ObjectExtensions
{
public static T GetTargetAs<T>(this SerializedProperty self) where T : class
{
var objectType = self.serializedObject.targetObject.GetType();
var field = objectType.GetField(self.propertyPath);
return field.GetValue(self.serializedObject.targetObject) as T;
}
}
}
#endif