[Unity] Resource Manager -text asset

sh·2024년 1월 3일
private void TextCallbackFunction<TextAsset>(string key, AsyncOperationHandle<TextAsset> handle, Action<TextAsset> callback) where TextAsset : Object
{
     handle.Completed += operationHandle => {
     if (!_resources.ContainsKey(key))
         _resources.Add(key, operationHandle.Result);

         callback?.Invoke(operationHandle.Result);
    };
}
          
loadKey = $"{key.Replace(".text", "")}";
AsyncOperationHandle<TextAsset> handle = Addressables.LoadAssetAsync<TextAsset>(loadKey);
TextCallbackFunction(loadKey, handle, callback as Action<TextAsset>);

텍스트 파일 타입 (csv, json) 파일을 accessable assets으로 로드 하는 함수

0개의 댓글