Files
sbox-public/engine/Sandbox.Tools/Scene/SceneUtility.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

30 lines
527 B
C#

using System.Text.Json.Nodes;
namespace Editor;
public static class SceneEditor
{
/// <summary>
/// Is there a <see cref="Component"/> type in the clipboard?
/// </summary>
public static bool HasComponentInClipboard()
{
var text = EditorUtility.Clipboard.Paste();
try
{
if ( JsonNode.Parse( text ) is JsonObject jso )
{
var componentType = TypeLibrary.GetType<Component>( (string)jso["__type"] );
return componentType is not null;
}
}
catch
{
// Do nothing.
}
return false;
}
}