ZMWSLI0-SL2021-GR11/cw1/clock/Library/PackageCache/com.unity.timeline@1.2.18/Editor/Utilities/ObjectExtension.cs

29 lines
641 B
C#
Raw Normal View History

2021-04-10 17:27:42 +02:00
using UnityEngine;
using UnityEditor;
namespace UnityEditor.Timeline
{
static class ObjectExtension
{
public static bool IsSceneObject(this Object obj)
{
if (obj == null)
return false;
bool isSceneType = obj is GameObject || obj is Component;
if (!isSceneType)
return false;
return !PrefabUtility.IsPartOfPrefabAsset(obj);
}
public static bool IsPrefab(this Object obj)
{
if (obj == null)
return false;
return PrefabUtility.IsPartOfPrefabAsset(obj);
}
}
}