using UnityEngine; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.AddressableAssets; public class CreateFloor : MonoBehaviour { public static void SetFloor(bool isFirstCreation = false) { //print("_G.FLCs=====" + _G.FLCs);//_G.FLCs=====CERA.13?#FFFFFF?#323232?#737373?1_1?56?0.5?0.1666667?0 if (_G.FLOOR == null || string.IsNullOrEmpty(_G.FLCs)) return; _G.FLOORMAT = UIT_MATERIAL.GetMaterial(_G.FLCs); if (_G.FLOOR.TryGetComponent(out var floorRenderer)) floorRenderer.material = _G.FLOORMAT; string Code = _G.FLCs.Replace("?", ","); Addressables.LoadAssetAsync(Code.Split(",")[0]).Completed += Texture_Completed; } private static void Texture_Completed(AsyncOperationHandle handle) { if (handle.Status == AsyncOperationStatus.Succeeded) { Texture2D AdressableTexture = Instantiate(handle.Result); _G.FLOORMAT.SetTexture("_Texture", AdressableTexture); _G.FLOORMAT.DisableKeyword("_ENABLE_SPECULAR"); } } }