summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Utilities/ObjectExtension.cs
blob: 863500d1c208918c5eb43fd55f9f01ad65384597 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
        }
    }
}