WuhuIslandTesting/Library/PackageCache/com.unity.addressables@1.21.12/Tests/Editor/TestObject.cs

29 lines
982 B
C#
Raw Normal View History

2025-01-07 02:06:59 +01:00
using UnityEngine;
namespace UnityEditor.AddressableAssets.Tests
{
public class TestObject : ScriptableObject
{
public static TestObject Create(string name, string assetPath = null)
{
var obj = CreateInstance<TestObject>();
obj.name = name;
if (!string.IsNullOrEmpty(assetPath))
{
AssetDatabase.CreateAsset(obj, assetPath);
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
}
return obj;
}
internal void AddTestSubObject()
{
TestSubObject n = ScriptableObject.CreateInstance<TestSubObject>();
n.name = "testSubObject";
AssetDatabase.AddObjectToAsset(n, this);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(this), ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
}
}
}