Delight icon indicating copy to clipboard operation
Delight copied to clipboard

Models not propagating update to view

Open PLMCHL opened this issue 3 years ago • 0 comments

Hi, first off, thank you for your effort, I'm having a lot of fun adding some menus to my learning game. It's proven to be super convenient and easy, but I did hit a snag.

I wanted to use a Models binding to be able to update the UX of my game, that I present through a ViewPresenter.

View

<GameInterfaceView>
  <Group Spacing="10">
    <Label Id="TurnLabel"  Text="Turn {@TurnValue}" />
  </Group>
</GameInterfaceView>

Models

namespace Delight
{
    public partial class Models
    {
        public static int TurnValue = 0;
    }
}

I call it from a MonoBehaviour class attached to a game object.

Delight.Models.TurnValue = 1;

I validate that the Models value is updated, but it does not seem to update the text in GameInterfaceView. Are these bindings expected to be two way? I started reading the code a bit, but I can't quite figure out how it works and why I am having this issue.

Alternatively, there might be a way to do what I want differently. Am I using the correct approach here? I am simply trying to update the turn counter whenever the game turn changes.

Thanks!

PLMCHL avatar Jul 30 '22 03:07 PLMCHL