Performance Comparison of the hot update solution officially released by Unity
IOS hot update for Unity applications
Author: Ding Zhiyu
Unity export ieschina
Agenda
? What is hot update?
? Why hot update?
? How to hot update Unity applications on iOS
? Comparison of various Lua plug-ins supporting Unity iOS hot updates
What is hot update?
? General Definition
? You do not need to shut down the server, fix vulnerabilities and update resources without stopping services. The key is to update the logic code.
? Narrow definition (iOS hot update)
? You can update the code executed on the client without re-packaging and submitting the code to the AppStore, that is, automatically updating the program without downloading the app.
? Status quo
? Apple prohibits some reflection operations on C #, JIT (instant compilation, creation and running of New Code when the program is running), logical hot update, and AssetBundle for hot resource update.
Why hot update?
? Shorten the process for users to obtain the new application client and improve user experience.
? Specific reasons for iOS applications are as follows:
? The review cycle of the App Store is difficult to control.
? Mobile apps are updated frequently.
? For large applications, the update cost is too high.
? Ultimate status
? The content of an application is completely changed without being downloaded again or stopped.
How to hot update Unity applications on iOS
? Hot update of Android applications
? Compile the Execution Code into assemblydll.
? Package the code as a TextAsset into Assetbundle.
? When running, use the Reflection mechanism to implement the Code function.
? Update the corresponding Assetbundle to implement hot update.
? Similarities and differences between Android and iOS hot updates
? Apple officially prohibits hot update of apps in iOS; JIT is invalid in iOS.
? Hot update solution: Unity + Lua plug-in.
? How iOS hot Update works with Lua plug-in
? Notes about Unity hot update
? The code and resources to be updated must be packaged into AssetBundle (uncompressed format is recommended)
? Several important paths of Unity
? Resources (read-only)
? StreamingAssets (read-only)
? Application. dataPath (read-only)
? Application. persistentDataPath (read/write)
? Resources of important paths
? Resources in the Resources folder are packaged whether used or not.
? Resources are compressed and converted to binary
? Read-Only resources in the packaged folder
? Cannot be dynamically changed, cannot be hot updated
? Use Resources. Load to Load
? StreamingAssets of important paths
? Cache directory of Stream Data
? Resources in the folder are packaged whether used or not.
? Resources are not compressed and encrypted
? The resources in the packaged folder are read-only and mainly store binary files.
? Unable to perform hot update
? WWW class loading (CreateFromFile is generally used. If the resource is AssetBundle, it is determined by whether it is compressed Based on the packaging method)
? Relative path. The specific path depends on the actual platform.
? Application. streamingAssetsPath
? IOS: Application. dataPath + "/Raw" or Application/xxxxxxxx-xxxx-xxxxxxxxxx/xxx. app/Data/Raw
? Important Path: Application. dataPath
? Path of the game's data folder (for example, Assets in the Editor)
? Rarely used
? Unable to perform hot update
? IOS path: Application/xxxxxxxx-xxxx-xxxxxxxxxxxx/xxx. app/Data
? Application. persistentDataPath
? Path of the persistent data storage directory (sandbox Directory, which does not exist before packaging)
? Resources in the folder are packaged whether used or not.
? It is valid during running and can be read and written.
? NO content restriction. Read Binary files from StreamingAsset or read files from AssetBundle to write data to PersistentDataPath.
? Suitable for hot update
? IOS path: Application/xxxxxxxx-xxxx-xxxxxxxxxxxx/Documents
? General process of iOS hot update using Lua plug-in
Comparison of various Lua plug-ins supporting Unity iOS hot updates
? ULua (asset store)
? Native version of uLua plug-in
? No static code
? Reflection mechanism, low efficiency, slow speed, frequent gcalloc
? Update maintenance has been stopped and Unity5.x is not supported.
? ULua & cstoLua
? Mature and stable development platform, Fast Bug fixes
? Numerous developers and rich resources
? Static Method with excellent performance
? There are successful commercial product cases (three kingdoms, super god team, cool fish fishing, Jedi war police, this is not a turret, etc.) Fish, Jedi war police, this is not a turret, etc)
? Both are improvements based on the native version. In the future, the two will be merged into a plug-in.
? SLua
? Static Method with excellent performance
? Concise core code
? Fewer resources, less mature and stable development platforms
? No success commercial product cases success commercial product Cases
? Improvements based on native versions
Comparison of various Lua plug-ins supporting Unity iOS hot updates
? C # Light (L #)
? Fade out of mainstream
? UniLua
? C # an incomplete solution for implementing the Lua Virtual Machine
? Fade out of mainstream
Comparison of various Lua plug-ins supporting Unity iOS hot updates
Then there is the testing code of uLua and sLua.
In summary, uLua is definitely better.