I am new to unity so i tried to instantiate an prefab'ed gameObject which is called "prefabcyl" and it is a Rigidbody. When i use this script:
var turn_yaw_y_axis=0.0;
var z=0.0;
var spawn=0.0;
function Update () {
spawn=Input.GetAxis("spawn");
z=z+Input.GetAxis("Vertical");
turn_yaw_y_axis=Input.GetAxis("Horizontal");
transform.Translate(0,0,z/8);
transform.Rotate(0,turn_yaw_y_axis,0);
if (spawn>0){
var clonecyl : Rigidbody;
clonecyl=Instantiate(clonecyl,transform.position+Vector3(0,0,7));
};
z=z/1.5;
print(z);
};
it shows this error: "Assets/game for KONGREGATE/script for Main Cam.js(12,21): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.Transform, UnityEngine.Vector3)' was found." Is there a way to fix it? I am using javascript and the script is placed on "MainCamera", a camera.