- Home /
Question by
Uvajed · Dec 13, 2014 at 03:26 PM ·
javascriptrigidbodycompile-errorbce0019
UnityEngine.GameObject Error
#pragma strict
var mermi : GameObject;
var kalanmermi : float = 30;
var yazi : GUIText;
var muzzleflash : Renderer;
var muzzlelight : Light;
var ateszamani : float = 0;
var siralama : float = 0.1;
function Start () {
yazi.enabled = false;
muzzleflash.enabled = false;
muzzlelight.enabled = false;
}
function Update () {
if(ateszamani > 0) {
ateszamani -=Time.deltaTime;
}
if(ateszamani < 0){
ateszamani = 0;
}
if(Input.GetMouseButton(0)&& kalanmermi){
if(ateszamani == 0){
var mermii = Instantiate(mermi,transform.position,Quaternion.identity);
mermii.rigibody.AddForce(transform.forward*2900);
ateszamani = siralama;
Ammo();
Effek();
}
}
}
function Ammo () {
kalanmermi --;
if(kalanmermi < 1){
yazi.enabled = true;
yield WaitForSeconds (2);
yazi.enabled = false;
kalanmermi +=30;
}
}
function Effek () {
muzzleflash.renderer.enabled = true;
muzzlelight.enabled = true;
yield WaitForSeconds(0.02);
muzzleflash.renderer.enabled = false;
muzzlelight.enabled = false;
}
Error : Assets/Scriptler/Namlu.js(26,8): BCE0019: 'rigibody' is not a member of 'UnityEngine.GameObject'.
Help Me Please
Comment
Answer by Antony-Blackett · Dec 13, 2014 at 03:27 PM
You spelt rigidbody wrong.
change line 26 to this:
mermii.rigidbody.AddForce(transform.forward*2900);
@Uvajed - Please accept the answer by clicking the tick mark.
Answer by Ericool · Dec 13, 2014 at 05:57 PM
In order to make sure when you instantiate you put after that if(mermii.GetComponent() == null) mermii.AddComponent();
Your answer
Follow this Question
Related Questions
Player Rotation with the mouse 1 Answer
How to make a rigid body ignore collider 1 Answer
object is not a member of 'UnityEngine.Component'. 1 Answer
Android Compiler Errors 1 Answer
AddTorque Isn't Working? 1 Answer