Getting "bundleVersion" from PlayerSettings #83
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Since I assume this is a PC game, and not in a bundle, you will need to load the class database: am.LoadClassPackage("classdata.tpk");
am.LoadClassDatabaseFromPackage(inst.file.typeTree.unityVersion);
AssetsView is a bit misleading here. The actual asset isn't named, so AssetsView defaults to the same name as the type. GetAssetInfo only looks for the m_Name field if it exists, so it won't help you. GetAssetsOfType is the right way, although it returns an array so you could just do [0] on it instead of a foreach loop. Also, PlayerSettings is notorious for changing often and it's possible that you will have read errors or missing fields if you try to read the PlayerSettings asset (it will probably throw an OutOfMemoryException.) In that case, you may want to use the large classdata.tpk file in the releases. You can also try the new dev branch of AssetsTools.NET which has better versioning support: https://github.com/nesrak1/AssetsTools.NET/tree/upd21-with-inst, but you would need to grab a different kind of tpk from https://nightly.link/AssetRipper/Tpk/workflows/make_tpk/master. The wiki has more info on how to use that new version here: https://github.com/nesrak1/AssetsTools.NET/wiki/Getting-Started:-Assets-file-reading. |
Beta Was this translation helpful? Give feedback.

Since I assume this is a PC game, and not in a bundle, you will need to load the class database:
AssetsView is a bit misleading here. The actual asset isn't named, so AssetsView defaults to the same name as the type. GetAssetInfo only looks for the m_Name field if it exists, so it won't help you. GetAssetsOfType is the right way, although it returns an array so you could just do [0] on it instead of a foreach loop.
Also, PlayerSettings i…