I asked this question before, and it was answered. The problem was fixed. However, there’s a second “Public” in the script that isn’t recognized. I’m out of ideas now.
I’m a beginning JavaScript user. This script is for a ‘click-shoot’ kind of thing.
This is the script:
#pragma strict
var myInt : int = S;
function MyFunction(number : int) : int
{
var ret = myInt * number;
return ret;
}
public : Rigidbody;
projectile;
{
}
public float speed = 20;
void Start () {
}
void Update () {
if (Input.GetButtonDown("Fire1"))
{
Rigidbody;
instantiatedProjectile = Instantiate(projectile,
transform.position,
transform.rotation)
as Rigidbody;
instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0,speed));
}
}
everytime you see “Expecting EOF found” it means you are missing a bracket like this }. haha.
count em up and add where needed. the error the line shows on is not usually where the missing bracket is sopposed to be!
This script has a lot of issues. It seems that there are a lot of things written in c# but the script is in javascript.
For example,
public float speed = 20f;
Is c#. The javascript way would be
var speed : float = 20;
Also, you have this statement which doesn’t mean anything:
public : Rigidbody;
projectile;
{
}
Brackets are unnecessary and projectile is out of place. You probably want
var projectile : Rigidbody;
Then you have Update and Start functions written in c#
void Update()
Should be
function Update()
Finally, you have placed a semicolon that doesn’t belong there:
Rigidbody;
instantiatedProjectile = Instantiate(projectile,
transform.position,
transform.rotation)
as Rigidbody;
should be
Rigidbody
instantiatedProjectile = Instantiate(projectile,
transform.position,
transform.rotation)
as Rigidbody;
I highly recommend watching some beginner tutorials. Copy pasting without understanding basic code syntax will get you nowhere. There are many tutorials here to get you started Unity Connect