Files
2025-11-30 08:35:03 +02:00

33 lines
692 B
C#

using System;
using System.Linq;
using JetBrains.Annotations;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
namespace Needle.Engine.ProjectBundle
{
public class NpmDefObject : ScriptableObject
{
[SerializeField, HideInInspector] [UsedImplicitly] internal string displayName;
private Bundle bundle;
private void OnEnable()
{
this.bundle = FindBundle();
displayName = this.bundle?.FindPackageName() ?? "";
}
public Bundle FindBundle()
{
var path = AssetDatabase.GetAssetPath(this);
return BundleRegistry.Instance.Bundles.FirstOrDefault(b => b.FilePath == path);
}
public override string ToString()
{
return displayName;
}
}
}