-
Hello. I need to replace a specific file in an .asset archive but before I do that I need to verify the file that is already in the archive. So I'd need to get the actual file or atleast byte[] array of it. I know about the BundleHelper.LoadAssetDataFromBundle but that only works for bundle files. I need the exact same thing but for asset files and there is no such method in AssetHelper class. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Do you mean an .assets file? Are you asking how to check if an asset exists in the assets file? That depends on how you want to identify it. Do you want to find it by path id? Do you want to find it by name? If you try to find it by name, you may run into collisions since names don't have to be unique. |
Beta Was this translation helpful? Give feedback.
I don't think there's a built in method to export an asset to byte array, but you can use this code from UABEA: https://github.com/nesrak1/UABEANext/blob/fcb4f8a0313e341121bb98e6bc4bd3b4d7417afa/UABEANext4/Logic/ImportExport/AssetExport.cs#L20-L33 and make
_stream
a new MemoryStream or something.DumpRawAsset(afile.Reader, info.GetAbsoluteByteOffset(afile), info.ByteSize);