Hot reload support #68
-
Hi! I have created demo project with one View and ViewModel. Set default value for BindableLabel in ViewModel and UXML. Started project and change value of bound property in ViewModel. After hot reloading state has been gone. View.cs
using UnityMvvmToolkit.UITK;
namespace HUD
{
public class View : DocumentView<MainViewModel>
{
}
} ViewModel.cs
namespace HUD
{
public class MainViewModel : IBindingContext
{
[Observable] public Property<string> Value = new("Bind value");
public MainViewModel()
{
Debug.Log("creating MainViewModel");
}
}
} View.uxml
<ui:UXML xmlns:ui="UnityEngine.UIElements"
xmlns:uie="UnityEditor.UIElements"
xsi="http://www.w3.org/2001/XMLSchema-instance"
engine="UnityEngine.UIElements"
editor="UnityEditor.UIElements"
noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd"
editor-extension-mode="False">
<UnityMvvmToolkit.UITK.BindableUIElements.BindableLabel binding-text-path="Value"
text="Default value"
style="font-size: 64px;"/>
</ui:UXML>
Demo: I tried sample Mvvm.Counter and there is same behavior. But in my general project there is one view, that doesn't loose its state after hot reload. So my question is: is hot reload supported or it is issue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi there, I don’t quite understand what you mean by hot reload? Can you describe step by step what actions you perform and what result you expect? P.S. What version of Unity do you use? |
Beta Was this translation helpful? Give feedback.
Unfortunately, this use case is not supported. But I’ll think about how to implement hot reload support in the feature.