- changed status to resolved
Changing Values inside a OnValueChanged Callback with Structs
Issue #274
resolved
Below is a boiled down example of the problem i'm currently running into
public struct Foo
{
[OnValueChanged(nameof(ValueChanged))]
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)
-
- Log in to comment
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 1.0.6.0 release.