Hello everyone.
I’ve looked around Google and the Unity forums for quite a while without finding an answer to my problem.
I am using the latest version of Unity, in a 2D project.
I am currently trying to access an Animator boolean from a script. When I click on the bool from the Animator window, it works normally, but I can’t toggle it with the script for some reason.
I have another Animator bool system for walking animations, and it works.
The boolean’s name is “TextBox Active”,
I am trying to toggle it on and off with script. Pressing on the Space key should open the text box, and close it if it’s already open.
Here’s my script :
using UnityEngine;
using System.Collections;
public class TextBoxAnimation : MonoBehaviour {
public bool textBoxActive;
void Start ()
{
textBoxActive = GameObject.Find("TextBox").GetComponent<Animator> ().GetBool ("TextBox Active");
}
void FixedUpdate ()
{
if (Input.GetKeyDown (KeyCode.Space))
{
textBoxActive = !textBoxActive;
}
}
}
This is the last thing I tried out before asking for help here. I have also tried to go with : “public Animator textBoxActive;” and using .SetBool(“TextBox Active”, true) and .SetBool(“TextBox Active”, false), but it didn’t work either.
This problem occurs every time I try to create a toggle. Sometimes, one part of the code will work, but the bool won’t come back from its “inverted” position.
I always use “bool = !bool;” whenever I can, but it doesn’t work.
Since I’m a complete newcomer to C#, I know that I am doing something wrong and not seeing it. My code doesn’t give me error messages in the console.
Thanks in advance for your help.

Sorry, I have another question. Is the idea to make everything at least a unit, or does that matter? Obviously you would need an ant of a character to stand on a 24x24 tile at 100 ppu.
– Jabes22Again, I don't know why these mysterious squares should affect you in any way. Just ignore them. I know for sure that I never had to deal with them. You can mix different PPU values if that's what you want. It's uncommon since most retro-style games aim to replicate the look of the old games that used such low resolutions that the size of each pixel was apparent and also impossible to affect.
– Cherno