- Home /
Question by
alexgonegaming · Apr 21, 2013 at 09:39 PM ·
erroriosfpsnotworking
IOS Gun shooting script
I'm working on an IOS FPS game and I just added a gun. I'm pretty new to unity and stuff. So what script should I add so it shoots when you tap a GUI at the bottom of the screen? All the tutorials I've found are for the computer and it doesn't respond to touch so it doesn't really help. Thanks in advance!
Comment
Answer by proandrius · Apr 22, 2013 at 12:03 AM
You should: if(Input.GetMouseButtonDown(0)) { shoot(); } // GetMouseButtonDown will work as a touch on iOS. But if you are using GUI: if(GUI.Button(new Rect(0,0,100,30),"Shoot")) { shoot(); }.
For shooting you should read about Instantiate function.