C# Unity Tutorial: Conditionals Question

Hello! In the conditionals video for the C# Unity tutorial he changes the value shown in the image to 1 (before it was 0). He says that the validateNames checkbox would be useless if the value was 0. I’m confused as to why this is the case and was wondering if anybody could explain this for me. Thanks in advanced.

image

@bdmoakley Can you please help with this when you get. a chance? Thank you - much appreciated! :]

I wasn’t talking about the code when I made that statement, I was referring to the logic. Here’s the breakdown, validateNames is boolean value indicating the code at some point should analyze the player names. Typically you’d do this to make sure there isn’t swearing or trolling. Or even if there is a name in place. The s at the end validateNames indicates this operation will run on multiple names, not a singular name.

If my playerCount is 1, it doesn’t make sense to validate a group of names since there is only one name. The code is valid, but the logic is a little confusing which is why I made the comment.

I hope that clears it up. Thanks!

1 Like

Thanks, this helped a lot!

This topic was automatically closed after 166 days. New replies are no longer allowed.