Changing Values inside a OnValueChanged Callback with Structs

Issue #274 resolved
created an issue

Below is a boiled down example of the problem i'm currently running into

public struct Foo
    public int value;

    public int mod;

    public void ValueChanged()
        mod = value % 5;

        Debug.Log( "Mod: " + mod );

The ValueChanged method is getting called, the Debug output looks like its correct, but any changes are not stored. If i had to guess, since this is a struct, its getting passed by value somewhere and we are working with a copy inside the ValueChanged method. Is it possible to be working with the original struct so that changes are not lost?

Comments (1)

  1. Log in to comment