- Home /
Question by
Sweps · Aug 13, 2014 at 03:21 PM ·
script error
What is wrong in this script?
I'm new to scripting and I have no idea what's wrong in this script. I'm trying to make a particle effect (a flamethrower) appear when I hit the second mb, or Fire2. I have a box collider around it to detect enemys and take damage.
The error says: /Scripts/FlameThrower.js(13,32): BCE0017: The best overload for the method 'UnityEngine.Input.GetMouseButton(int)' is not compatible with the argument list '(String)'.
Script:
#pragma strict
var FlameThrower : ParticleSystem;
function Start ()
{
FlameThrower.emissionRate = 0.0f;
GameObject.Find("FlameCollider").GetComponent(Collider).enabled = false;
}
function Update ()
{
if(Input.GetMouseButton("Fire2"))
{
FlameThrower.emissionRate = 150.0f;
GameObject.Find("FlameCollider").GetComponent(Collider).enabled = true;
}
else
{
FlameThrower.emissionRate = 0.0f;
GameObject.Find("FlameCollider").GetComponent(Collider).enabled = false;
}
}
Comment