Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToDynamicAsset() fails with conflicting Script ID hashes #2

Open
therealchjones opened this issue Jun 1, 2021 · 0 comments
Open

ToDynamicAsset() fails with conflicting Script ID hashes #2

therealchjones opened this issue Jun 1, 2021 · 0 comments

Comments

@therealchjones
Copy link

ToDynamicAsset() method uses a static dictionary via GetDeserializer() that indexes deserializers based on hashes of ScriptIDs, but then loading slightly different types with the same hash can cause an error. (For me, this happens when opening analogous AssetBundleFiles from different versions of the same program.) It appears that assets within the same version of an application don't have any overlaps in hashes, but there are collisions with different types between different versions. (See, for instance, the attached test project.) While exceptions are thrown sometimes when this happens, it may be that others fail silently.

This can be mitigated by calling GenDeserializer directly rather than using GetDeserializer (or, therefore, ToDynamicAsset), but this of course gets rid of the benefit of the cache. Rather than making this a static method (and static dictionary), would it be preferable to make it a property of the AssetBundleFile so that loading different assetbundles would not result in these errors? Another possibility would be the addition of a method to "reset" the static dictionary when necessary to load a different version that may have overlapping hashes.

DynamicAssetTest.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant