So i have this script:
- #pragma strict
-
- public var IsShooting : boolean = false;
-
- function Update (){
-
- if(Input.GetButtonDown (“Fire1”)){
- IsShooting = !IsShooting; // toggles onoff at each click
-
- if (IsShooting){
- print(“You’re shooting!”);
- } else {
- print(“Not shooting”);
- }
- }
- }
I found it on the forums as an answer, just to try it out but it’s not working(doing something wrong most likely).
So i have 2 problems.
1- It does enable and prints “You’re shooting!”, but doesn’t change the bool in the parameter:/
2- I also have no clue how to make it so when i hold it, it shoots, instead of toggling. I did try changing a few things here and there like IsShooting = True; then on button release IsShooting = False; But it was constantly on. So i went back to the original script ![]()
The bool’s name is also “IsShooting”
It’s attached to the weapon “Mac-10” which is the gameobject with the animator and controller.
So any help would be appreciated ![]()