New answers tagged

4 votes

Can I lessen the use of boolean flag variables in this snippet?

You currently have two booleans, capable of representing 4 states (like many other answers have shown with helpful truth tables). But there's actually only 3 cases here: show, hide, and do nothing. If ...
neonblitzer's user avatar
6 votes

Can I lessen the use of boolean flag variables in this snippet?

Since this is tagged unity3d, rather than setting a flag somewhere else in the script, you can just do the following: ...
crass_sandwich's user avatar
2 votes

Can I lessen the use of boolean flag variables in this snippet?

I'd do: ...
meriton's user avatar
  • 514
3 votes

Can I lessen the use of boolean flag variables in this snippet?

I think a higher level review of how this whole button thing works. I want to express a slightly different approach and instead of bShow and ...
chux - Reinstate Monica's user avatar
0 votes

Optimize and Simplify Raycasting Code in Unity for Store Clerk Interaction?

You could simplify the code by reducing redundant checks and combining conditions. ...
suchislife's user avatar
7 votes

Can I lessen the use of boolean flag variables in this snippet?

Why don't you make button.show() simply do an early exit if the visibility state being passed in is already the same? I'm surprised it doesn't already work this ...
selbie's user avatar
  • 197
0 votes

Optimize and Simplify Raycasting Code in Unity for Store Clerk Interaction?

SCText.SetActive(true); LookingStoreClerk = true; ... SCText.SetActive(false); You never set ...
J_H's user avatar
  • 14.1k
10 votes

Can I lessen the use of boolean flag variables in this snippet?

Each call to handleInputEvents() can set bShow to a new boolean value. We could approach the display update task by making a truth table. ...
J_H's user avatar
  • 14.1k
17 votes

Can I lessen the use of boolean flag variables in this snippet?

Can I lessen the use of boolean flag variables in this snippet? Consider 1st comparing. ...
chux - Reinstate Monica's user avatar
10 votes

Can I lessen the use of boolean flag variables in this snippet?

I'm not familiar with unity so, I can't review your code from that perspective. But we can certainly make this code more concise. Let me show you how to get started with refactor this code. 1. Get rid ...
Peter Csala's user avatar
  • 8,420

Top 50 recent answers are included