study/first_study/Library/PackageCache/com.unity.timeline@7f8b2fb101b6/Editor/ObjectIdExtension.cs
jh04010421 739d49f1a0 Unity | 2026.01.20
수업 실습 파일
2026-01-20 11:01:57 +09:00

45 lines
1.5 KiB
C#

using System.Collections.Generic;
using System.Linq;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Timeline;
namespace UnityEditor.Timeline
{
static class ObjectIdExtension
{
public static Object IdToObject(this ObjectId id)
{
#if UNITY_6000_3_OR_NEWER
return EditorUtility.EntityIdToObject(id);
#else
return EditorUtility.InstanceIDToObject(id);
#endif
}
public static List<ObjectId> GetNewSelection(ObjectId id,
List<ObjectId> allInstanceIDs, List<ObjectId> selectedIDs, ObjectId lastClickedId, bool keepMultiSelection, bool useShiftAsActionKey, bool allowMultiSelection)
{
#if UNITY_6000_3_OR_NEWER
return InternalEditorUtility.GetNewSelection(id, allInstanceIDs.ConvertAll(i => (EntityId)i), selectedIDs.ConvertAll(i => (EntityId)i), lastClickedId, keepMultiSelection, useShiftAsActionKey, allowMultiSelection)
.ConvertAll(i => (ObjectId)i);
#else
return InternalEditorUtility.GetNewSelection(id, allInstanceIDs.ConvertAll(i => (int)i), selectedIDs.ConvertAll(i => (int)i), lastClickedId, keepMultiSelection, useShiftAsActionKey, allowMultiSelection)
.ConvertAll(i => (ObjectId)i);
#endif
}
public static IEnumerable<ObjectId> selectedIds
{
get
{
#if UNITY_6000_3_OR_NEWER
return Selection.entityIds.Select(id => (ObjectId)id);
#else
return Selection.instanceIDs.Select(id => (ObjectId)id);
#endif
}
}
}
}