mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-09 04:19:42 -05:00
asset に対する UnityEngine.Object.DestroyImmediate の挙動確認
This commit is contained in:
41
Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs
Normal file
41
Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public class AssetTests
|
||||
{
|
||||
[Test]
|
||||
public void TestAsset()
|
||||
{
|
||||
var mesh = new Mesh();
|
||||
var assetPath = AssetDatabase.GenerateUniqueAssetPath("Assets/test_mesh.asset");
|
||||
var loaded = default(Mesh);
|
||||
|
||||
try
|
||||
{
|
||||
Assert.IsFalse(AssetDatabase.IsMainAsset(mesh));
|
||||
Assert.IsFalse(AssetDatabase.IsSubAsset(mesh));
|
||||
|
||||
AssetDatabase.CreateAsset(mesh, assetPath);
|
||||
|
||||
Assert.IsTrue(AssetDatabase.IsMainAsset(mesh));
|
||||
Assert.IsFalse(AssetDatabase.IsSubAsset(mesh));
|
||||
|
||||
loaded = AssetDatabase.LoadAssetAtPath<Mesh>(assetPath);
|
||||
Assert.AreEqual(mesh, loaded);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// remove assetPath
|
||||
UnityEngine.Object.DestroyImmediate(loaded, true);
|
||||
|
||||
var tmp = AssetDatabase.LoadAssetAtPath<Mesh>(assetPath);
|
||||
Assert.Null(tmp);
|
||||
}
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs.meta
Normal file
11
Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 513b70f5eb05a53479b2b12a85139cbe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user