5
votes
If statements seem to act as though the condition is always true
Remove the semicolon at the end of your if statements.
That semicolon tells the compiler "I'm done with this" and whatever comes next is a new, unrelated statement
So this (note semicolon at the end ...
2
votes
Accepted
Animator from another gameobject keeps disappearing from script on play
As is usually the case, this is happening because you told Unity that's what you wanted to happen.
This block says:
...
2
votes
Count the number of Vulnerable and Invulnerable crops
Alternatively, you can use the Linq lambda like so:
...
2
votes
Accepted
Count the number of Vulnerable and Invulnerable crops
Is there something wrong with a simple for loop?
...
2
votes
Accepted
How to save boolean to player prefs in Unity?
It is because you are setting PlayerPref in Update method. Now, you start your game, ant object's values are reset to initial value. So music object becomes null and musicOn becomes true (because you ...
1
vote
Accepted
Need help accessing booleans from other script Unity3D
As DMGregory observed, it seems like your root issue is that you are setting dead to false each time you spawn a platform:
...
1
vote
How to use a boolean to activate every item with the same tag?
FindGameObjectsWithTag only finds already active GameObjects. From the documentation:
Returns an array of active GameObjects tagged ...
1
vote
Accepted
In unity C#, why use the .SetBool(booleanname, boolean) command when you could just write 'booleanname = true'?
These two lines do different things.
animator.SetBool("isRunning", true)
This sets The Animator's isRunning parameter to true ...
Only top scored, non community-wiki answers of a minimum length are eligible