Questions tagged [boolean]
A type of data with only two possible values, usually "true" or "false".
18 questions
0
votes
0
answers
691
views
Booleans cannot be changed between scripts in Unity
In my game there is a game manager that interacts with all players and is able to change whether a player is actionable by accessing their script. However, the Game manager script simply refused to ...
0
votes
2
answers
2k
views
How to save boolean to player prefs in Unity?
I'm making a player settings thing where the user can turn off or turn on the game music by clicking buttons. I had this script below and everything was working fine.
...
0
votes
1
answer
1k
views
In unity C#, why use the .SetBool(booleanname, boolean) command when you could just write 'booleanname = true'?
I noticed on a tutorial for unity someone used the code:
private Animator animator;
private bool isRunning = false;
While further on, did:
...
0
votes
1
answer
171
views
Animator from another gameobject keeps disappearing from script on play
I am working on a gun script and it worked fine until earlier today when I made a change to the script and it stopped working. I put it back, but for some reason now the animator object attached to ...
0
votes
1
answer
485
views
If statements seem to act as though the condition is always true
I have other scripts in the same project using boolean if statements that work fine, but I've tried multiple methods of testing if the if statements below are working and none of them worked!
I don't ...
0
votes
1
answer
36
views
Issues with Toggle
hope you're all good..
I'm struggling with a simple toggle for inverting Y axis..
What i have works for my first scene but i'm trying to keep this setting through all scenes, hence why the script ...
0
votes
1
answer
242
views
Playing an animation all the way through with one quick keypress with Mechanim Unity
I have an if statement inside of the Update function that is only called if three other conditions are met. The problem is that right now the function sets a boolean to true which causes the animation ...
14
votes
2
answers
32k
views
Is there a random command for Boolean variables in Unity C# [closed]
Can you randomly choose a Boolean's value in Unity C#. I tried random.range, but it only works with floats. Here is an example of what I'm trying to do:
...
3
votes
1
answer
772
views
If-clause in GLSL
I read a few thing about, that in GLSL both sides of the if-clause is executed, so do you have any idea for a workaround for this one:
...