- Home /
Mouse click IF not checking properly
I'm working on a strategy game and I've a script that checks if the blueprint you are currently looking to build is colliding with another building or an out-of-bounds area. If so then a bool becomes active: constructionBlocked
When you click the button to choose what building you want to place the buttons become locked ( interactable = false;
) If the is active then clicking the mouse will not place the building and the construction buttons will remain locked. However I'm having an issue that, even though the constructionBlocked
bool is still active, clicking will not place the building but it will unlock the buttons?
if (Input.GetMouseButtonDown(0) && constructionBlocked == false)
buildingParent = GameObject.FindGameObjectWithTag("BuildingParent");
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, out hit))
{
Debug.Log("Nothing wrong here!");
clickLocation = hit.point;
mouseFollower.isFollowing = false;
isBuilt = true;
buttonThingMaker.isPrinting = false;
buttonThingMaker.buttonlocker();
Screenshot added because 'Unity Answers' post formatting is awful
Your answer
Follow this Question
Related Questions
What am I doing wrong with this bool? 3 Answers
How Do I check if a Bool was True a few moments ago 2 Answers
Scavenger Hunt List Bools Question 1 Answer
Could use some help on making my runaway/chase/follow/patrol script cooperate with each other 1 Answer
I'm having trouble setting a bool. 2 Answers