Can branches fire true and false case simultaniously?

Dear reader,

I am in the proces of becoming familiar with unreal engine 4. I’m recreating the snake game and boy it is a lot of fun working in UE4. I actually have all the core concepts figured out, being moving around and eating/spawning food, game over if you hit the wall or yourself and that is pretty much it. Something I wanted to fix though was that new food sometimes spawn at the position of the snake. Which from a technical standpoint doesn’t really matter I guess, but I want to make this as polished as I can get it for the sake of practising.

Anyway, I have a bunch of stuff going on that will check the proposed position of the new food with the position of the snake head and tail to make sure there is no overlap. I created some print blocks to see if things where actually firing the way and order I was expecting. They seemed to do, there was recognition if the food was on the head or tail. However the food still spawned at that location and overlap was made. I placed a bunch of breakpoints to see what was going on and then I found this: Imgur: The magic of the Internet

What is going on here? They seem to fire both? Which is exactly the opposite thing that I expected a branch to do.

Thanks for your help :slight_smile:

Well, it’s on a ForEachLoop, it’s not really going off at the same time, what seems to be happening (in that pic anyway), in that iteration, False happened and in the next iteration True happened.

  • Your graph is a mess and doesn’t help with proper debugging
  • I would go ahead and start to clean it up for not only yourself but other if you really want help

But, I THINK, it’s that != conditional that is hooked up to your Branch, if that’s the case, then something is actually == and causing it to be true. Which, seeing how your logic is based on it being true is what you want, so with that assumption, you don’t want it true, so both those vectors are equal when it hits false. I’m just thinking outloud now, because your graph is making it kind of hard to read the situation.

Yea I completely agree the graph is a mess, this is after some messing around with stuff. The rest looks ok though, I promise! The thing you said about iterations is probably true though. I messed up my logic, I somehow need to break from the loop if it detects overlap or keep note of a collision bool or something. I thank you very much for your fast and helpful answer!

No problem :slight_smile: Glad I was able to help in some way.