NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Debug/TestUnityObjectReference.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2024-02-20 17:29:36 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
public class TestUnityObjectReference : MonoBehaviour
{
private List<Material> _testMatList = new();
public List<Material> serializableTestMatList = new();
// Start is called before the first frame update
void Start()
{
}
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);
Addressables.Release(mat);
Debug.LogError($"test reference:{_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);
Addressables.Release(mat);
Debug.LogError($"test reference:{serializableTestMatList[0].name}");
}
// Update is called once per frame
void Update()
{
}
}