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

36 lines
979 B
C#
Raw Permalink Normal View History

2025-01-07 02:06:59 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.AddressableAssets.Tests
{
[CreateAssetMenu(order = 0, fileName = "to", menuName = "Test/TestObject")]
public class TestObject : ScriptableObject
{
static public TestObject Create(string name)
{
var obj = CreateInstance<TestObject>();
obj.name = name;
return obj;
}
#if UNITY_EDITOR
static public TestObject Create(string name, string assetPath)
{
var obj = CreateInstance<TestObject>();
obj.name = name;
if (!string.IsNullOrEmpty(assetPath))
{
AssetDatabase.CreateAsset(obj, assetPath);
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
}
return obj;
}
#endif
}
}