Subscribing to events: “Value does not fall within the expected range”? (Unity xpost)

Hi all, I'm using Unity and I've created a Resource Container monobehavior, and am triggering various functions based on the values of resources when the player gains or loses some. I'm using this line to subscribe to a specific resources's value changed event: o2.OnValueChanged += events.raiseResourceChanged; raiseResourceChanged looks like this, and then tries to call a more general OnResourceChanged event. public void raiseResourceChanged() { if(OnResourceChanged != null) OnResourceChanged();
and I get this output in the console: ArgumentException: Value does not fall within the expected range. What might cause this? I have this kind of workflow in place all over my project without experiencing this problem so far, and I really appreciate any insight.

by Ryahes via /r/csharp

Leave a Reply