Skip to content

Reactions to nested Atoms #4

@slimshader

Description

@slimshader

Hi,

I think I am missing something still, code sample:

public class ExperimentsWindow : Window
{
    class ViewModel
    {
        [Atom]
        public int IntValue { get; set; } 
    }

    [Atom]
    ViewModel VM { get; set; }

    private void Start()
    {
        Initialize();

        VM = new ViewModel() { IntValue = 5 };

        // tried this too: Atom.Reaction(() => Debug.Log($"Int value {VM.IntValue}"));
        Atom.Reaction(() => VM.IntValue, i => Debug.Log($"Int value {i}"));

        VM.IntValue = 6;

        VM = new ViewModel() { IntValue = 7 };
    }
}

When running, I always only see values "5" or "7" printed but not "6". Is there a way to React to changes in multi-level Atoms?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions