Open full view…

If-Else bug

Tue, 29 May 2018 14:53:22 GMT

Funny bug I found. If you have an if-else if statement with an if included in the first block that is false, the argument will continue to the else-if as if nothing happened if you do not have another block after the internal if:s end block. Confusing? I made you a unity package, you can find it yourself there! It was an odd one, to be sure. Kind of handy in a way, but best not to plan anything around it. D:

Steve Halliwell
Sat, 02 Jun 2018 09:56:10 GMT

Thanks Wolfrug, this is an amazing repro. Think I found a simple fix, need to test it further to make sure there isn't any functionality relying on the quirks that are causing the bug.

Sat, 02 Jun 2018 16:21:16 GMT

I actually found it when I realized I had a complicated if-else-if clause that for some reason was working "better than intended" - i.e. it should've just skipped to the end if the embedded if was false, but instead it continued on to the next else-if, which was really handy - but obviously buggy ;) Wouldn't it be nice if there was some way to include this functionality without the bug? It'd be pretty super :D