add kcp
This commit is contained in:
24
Src/Unity/Scripts/Object/ObjectExtensions.cs
Normal file
24
Src/Unity/Scripts/Object/ObjectExtensions.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#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
|
Reference in New Issue
Block a user