Changing Values inside a OnValueChanged Callback with Structs

Issue #274 resolved
Steamroller Studios 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. Tor Esa Vestergaard

    I've just resolved this issue. The fix isn't in the build I just sent you, but after taking a look at it, it was very easy to fix, so the fix will be in the final release.

  2. Log in to comment