Hello, sorry for the confusing title but I’m having a bit of a difficult time understanding what’s exactly going on.
Yesterday I decided to build using the master configuration as we are getting pretty close to release and found out some strange code execution patterns. I’ve only observed this when using the Master configuration. Release works just fine.
I’ll try to explain what’s happening and what should be happening. In our game, the object you are controlling (PC if you wish) can attach itself to a colored square. After a certain time, the PC will fall automatically.
When you attach yourself to a colored square we do 2 things: listen if PC’s parent object has changed and launch a timer to automatically fall after a certain amount of time.
...
this.NGGame.kyubBlock.OnParentChanged.AddListener(this.FallFromColor2);
...
this.fallFromColorCoroutine = this.DelayCall(this.colorTimeout, this.FallFromColor);
...
And here are those 2 functions:
private void FallFromColor()
{
if (this.isColorFreezed == true)
{
this.isColorFreezed = false;
this.stickingColorSquare.Fall.Invoke();
this.NGGame.kyubBlock.Unparent(this.stickingColorSquare.cacheTransform);
this.stickingColorSquare = null;
}
}
private void FallFromColor2(Block p)
{
this.NGGame.kyubBlock.OnParentChanged.RemoveListener(this.FallFromColor2);
this.FallFromColor();
}
If you wait for the timer to complete and fall off the following execution would occur:
- FallFromColor get called by the DelayCall.
- The PC will be unparented which would trigger FallFromColor2
- The listener would be removed since we are no longer being on a color
- FallFromColor is called again but this time isColorFreezed is set to false so we just exit the function.
This is the normal behavior that works fine. However when switching to Master configuration, things are different. I set some breakpoints, stepped through them and observed the following.
- FallFromColor would still be called because of DelayCall.
- If you try to step through the function it would just skip this.NGGame.kyubBlock.Unparent(this.stickingColorSquare.cacheTransform); and go to the end of the function.
- If you put the breakpoint the said line it would trigger twice.
- FallFromColor2 would also get triggered twice but the line this.NGGame.kyubBlock.OnParentChanged.RemoveListener(this.FallFromColor2); doesn’t seem to be executed at all.
The call stack is exactly the same and the thread doesn’t change but the behavior is definitely not what should be happening.
Again, sorry if this is too specific, but I’ll provide more details if needed.
Lastly, I’m building for Universal 10, using the .NET backend with unity 5.3.5p7