/* ┌──────────────────────────────────────────────────────────────────┐ │ Author: Ivan Murzak (https://github.com/IvanMurzak) │ │ Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) │ │ Copyright (c) 2025 Ivan Murzak │ │ Licensed under the Apache License, Version 2.0. │ │ See the LICENSE file in the project root for more information. │ └──────────────────────────────────────────────────────────────────┘ */ #nullable enable #if UNITY_6000_5_OR_NEWER using AIGD; namespace com.IvanMurzak.Unity.MCP.Runtime.Extensions { public static class ExtensionsRuntimeObjectRef { public static UnityEngine.Object? FindObject(this ObjectRef? objectRef) { if (objectRef == null) return null; #if UNITY_EDITOR if (objectRef.InstanceID != UnityEngine.EntityId.None) { return UnityEditor.EditorUtility.EntityIdToObject(objectRef.InstanceID); } #endif return null; } public static ObjectRef? ToObjectRef(this UnityEngine.Object? obj) { return new ObjectRef(obj); } } } #endif