脚本/功能 【更新】Live Script Reload (on device Hot-Reload) 1.8热重载

Unity插件信息
插件名称: Live Script Reload (on device Hot-Reload)
插件官网: https://assetstore.unity.com/packages/tools/utilities/live-script-reload-on-device-hot-reload-239380
版本: 1.8
解压密码:
素材类型: 脚本/功能


Tool will automatically compile only what you've changed and immediately hot-reload that into current play session.

Even better it'll do that on device, be it to already running .exe or deployed Android APK.

Iterate on whatever you're working on without restarting the app over and over again.

Works with any code editor.
Asset is a standalone extension to Fast Script Reload, you only need this package and single import to get started.

• Setup
1) Import
2) Create Build
2) Play Build and Editor
3) Make Code Change
4) See results
It's that simple.

• One-off custom code executions on Hot-Reload
When you need to set the stage to test your feature out.
Add following methods to changed script:
| void OnScriptHotReload()
| //do whatever you want to do with access to instance via 'this'
| static void OnScriptHotReloadNoInstance()
| //do whatever you want to do without instance
| //useful if you've added brand new type
| // or want to simply execute some code without |any instance created.
| //Like reload scene, call test function etc

• Performance
It's a development tool, you're not supposed to ship with it! :)
Your app performance won't be affected in any meaningful way though.
Biggest bit is additional memory used for your re-compiled code.
Won't be visuble unless you make 100s of changes in same play-session.
• Supports (Tested)
- Windows / Mac (Intel editor version only) / Linux
- Unity 2019.3
- Unity 2020.3
- Unity 2021.3
- Unity 2022.2
• Few things to have in mind, limitations:
• Generic methods and classes won't be Hot-Reloaded
Unfortunately generics will not be Hot-Reloaded, to workaround you'd need to move code to non-generic class / method.

• Creating new public methods
Hot-reload for new methods will only work with private methods (only called by changed code)

• Adding new fields (Experimental support added in 1.3)
You can now add new fields and tweak them in editor! Minor limitations:
- outside classes can not call new fields added at runtime
- new fields will only show in editor if they were already used (at least once)
- new fields will only work in editor workflow, they won't be propagated to build/device yet

• Extensive use of nested classed / structs
If your code-base contains lots of nested classes - you may see more compilation errors.

• Mac Silicon Editor version not supported
On Mac only Intel Editor version is supported. For Silicon version logs will show that everything is fine but actual change will not happen at runtime

• No IL2CPP support
Asset runs based on specific .NET functionality, IL2CPP builds will not be supported. Although as this is development workflow aid you can build your APK with Mono backend (android) and change later.

• Other minor limitations
There are some other minor limitations, please consult full list

• Roadmap
- add Mac/Linux support - (DONE, added with 1.1)
- add debugger support for hot-reloaded scripts (DONE, added with 1.2)
- allow to add new fields (adjustable in Editor) (DONE, added with 1.3)
- better compiler support to work around limitations

• FAQ
- How is this asset different to Fast Script Reload?
> Live Script Reload is a standalone extension to FSR, it includes all features and allows for same hot-reload functionlity directly on deployed build. You only need this one to have both.
- When importing I'm getting error: 'Unable to update following assemblies: (...)/ImmersiveVRTools.Common.Runtime.dll'
> This happens occasionally, especially on upgrade between versions. It's harmless error that'll go away on play mode.
- When upgrading between versions, eg 1.1 to 1.2 example scene cubes are pink
> This is down to reimporting 'Point' prefab. Right now plugin will make sure it's using correct shader eg. URP / Built-in but only on initial import.


该工具将只自动编译您所更改的内容,并立即将其热加载到当前游戏会话中。

更好的是,它会在设备上完成编译,无论是已经运行的 .exe 还是已部署的 Android APK。

无论你在做什么,都可以反复迭代,而无需重启应用。

可与任何代码编辑器配合使用。
Asset 是 Fast Script Reload 的独立扩展,你只需要这个软件包和一次导入即可开始使用。

- 设置
1) 导入
2) 创建构建
2) 播放构建和编辑器
3) 更改代码
4) 查看结果
就是这么简单

- 在 Hot-Reload 上一次性执行自定义代码
当你需要测试你的功能时。
在更改后的脚本中添加以下方法:
| void OnScriptHotReload()
| // do whatever you want to do with access to instance via 'this'.
| static void OnScriptHotReloadNoInstance()
| //do whatever you want to do without instance
| 如果你添加了全新的类型
| 或者想在不创建任何实例的情况下简单地执行一些代码。
| 比如重新加载场景、调用测试函数等。

- 性能
这是一个开发工具,你不应该用它来发货!:)
您的应用程序性能不会受到任何有意义的影响。
最大的影响是重新编译的代码会占用更多内存。
除非您在同一游戏会话中进行了 100 多处更改,否则不会有明显影响。
- 支持(已测试)
- Windows / Mac(仅限英特尔编辑器版本)/ Linux
- Unity 2019.3
- Unity 2020.3
- Unity 2021.3
- Unity 2022.2
- 需要注意的一些限制:
- 泛型方法和类不会被热重载
遗憾的是,泛型不会被热重载,要解决这个问题,您需要将代码移到非泛型类/方法中。

- 创建新的公共方法
新方法的热重载仅适用于私有方法(仅被更改代码调用)

- 添加新字段(1.3 中添加了试验性支持)
您现在可以添加新字段,并在编辑器中对其进行调整!小限制
- 外部类不能调用运行时添加的新字段
- 新字段只有在已被使用(至少一次)的情况下才会显示在编辑器中
- 新字段只能在编辑器工作流中使用,还不会传播到构建/设备中

- 大量使用嵌套类/结构体
如果您的代码库包含大量嵌套类,您可能会看到更多编译错误。

- 不支持 Mac Silicon 编辑器版本
Mac 只支持 Intel 编辑器版本。对于 Silicon 版本,日志会显示一切正常,但实际更改不会在运行时发生

- 不支持 IL2CPP
资产运行基于特定的 .NET 功能,因此不支持 IL2CPP 构建。不过,由于这是开发工作流程的辅助工具,您可以使用 Mono 后端(android)构建 APK,之后再进行更改。

- 其他小限制
还有其他一些小限制,请查阅完整列表

- 路线图
- 添加 Mac/Linux 支持--(已完成,1.1 版已添加)
- 为热加载脚本添加调试器支持(已完成,1.2 版已添加)
- 允许添加新字段(可在编辑器中调整)(已完成,1.3 版已添加)
- 更好地支持编译器以解决限制问题

- 常见问题
- 此资产与快速脚本重载有何不同?
> Live Script Reload 是快速脚本重载的独立扩展,它包含所有功能,并允许直接在已部署的构建程序上实现相同的热重载功能。你只需要这个扩展就能同时拥有这两项功能。
- 导入时出现错误:"无法更新以下程序集:(...)/ImmersiveVRTools.Common.Runtime.dll"。
> 偶尔会出现这种情况,特别是在版本升级时。这是一个无害的错误,会在播放模式下消失。
- 在不同版本之间升级时,例如从 1.1 升级到 1.2,示例场景立方体是粉红色的。
> 这是由于重新导入了 "点 "预制板。现在插件会确保使用了正确的着色器(如 URP / 内置着色器),但仅限于首次导入。



作者 cg小白兔 发表于 5 小时前
您需要登录后才可以回帖 登录 | 立即注册
cg小白兔

关注0

粉丝0

发布7097

热门作品推荐
glow
【更新】Digger - Terrain Caves & Overhan
glow
【更新】Digger - Terrain caves & overhan
glow
【更新】Colorize (Texture Color Palette
glow
【更新】Flat Kit Cel Toon Shading 4.7.8
glow
【更新】Basic Motions 2.3 人形角色动画库
glow
Non-Convex Mesh Collider. Automatic Gene
glow
【更新】Atmospheric Height Fog Optimize
glow
【更新】Asset Cleaner PRO - Clean Find
glow
【更新】Asset Cleaner PRO - Clean Find
glow
Collision Mesh Generator | Convex Decomp