82 lines
3.0 KiB
C#
82 lines
3.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.AddressableAssets;
|
|
|
|
public class TestUnityObjectReference : MonoBehaviour
|
|
{
|
|
private Material _testMat;
|
|
|
|
public Material serializableTestMat;
|
|
|
|
private List<Material> _testMatList = new();
|
|
|
|
public List<Material> serializableTestMatList = new();
|
|
|
|
public void Test()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
var mat = Addressables.LoadAssetAsync<Material>(path).WaitForCompletion();
|
|
_testMatList.Add(mat);
|
|
Debug.LogError($"Test:{_testMatList[0].name}");
|
|
}
|
|
|
|
public void TestEnd()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
Addressables.Release(_testMatList[0]);
|
|
Debug.LogError($"TestEnd:{_testMatList[0].name}");
|
|
}
|
|
|
|
public void TestSerializable()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
var mat = Addressables.LoadAssetAsync<Material>(path).WaitForCompletion();
|
|
serializableTestMatList.Add(mat);
|
|
Debug.LogError($"TestSerializable:{serializableTestMatList[0].name}");
|
|
}
|
|
|
|
public void TestSerializableEnd()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
Addressables.Release(serializableTestMatList[0]);
|
|
Debug.LogError($"TestSerializableEnd:{serializableTestMatList[0].name}");
|
|
}
|
|
|
|
public void TestSingleStart()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
_testMat = Addressables.LoadAssetAsync<Material>(path).WaitForCompletion();
|
|
Debug.LogError($"TestSingleStart:{_testMat.name}");
|
|
}
|
|
|
|
public void TestSingleEnd()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
Addressables.Release(_testMat);
|
|
Debug.LogError($"TestSingleEnd:{_testMat.name}");
|
|
}
|
|
|
|
public void TestSingleSerializableStart()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
serializableTestMat = Addressables.LoadAssetAsync<Material>(path).WaitForCompletion();
|
|
Debug.LogError($"TestSingleSerializableStart:{serializableTestMat.name}");
|
|
}
|
|
|
|
public void TestSingleSerializableEnd()
|
|
{
|
|
var path =
|
|
"Assets/Art/AutoGen/PostProcessScenes/Assets_Scenes_CampScene/Combined/NLD_URP_NLD_Scene_Lambert/CombieMat.mat";
|
|
Addressables.Release(serializableTestMat);
|
|
Debug.LogError($"TestSingleSerializableEnd:{serializableTestMat.name}");
|
|
}
|
|
}
|