- Home /
Syntax prob, UCE0001 error c#sharp to javascript
Hi,
though could someone point me to a tool or guide which explains briefly how to convert C#Sharp into javascript code for Unity?
In particular i struggle with this line of code :/
Vector3 position = new Vector3(transform.position.x, transform.position.y + ProjectileOffset);
Instantiate(ProjectilePrefab, position, Quaternion.identity);
Thanks for your time + help
UPDATE
Testing now http://sharpkit.net (C# to JavaScript Converter) <--- not working
UPDATE
Thanks Eric.
I have now
private var projectileOffset : Vector3;
private var position : Vector3;
var position = new position(transform.position.x, transform.position.y + projectileOffset);
But get BCE0051 Operator + cannot be used with a left hand side of type float and right hand side of type UnityEngine.Vector3
Comment
Answer by Eric5h5 · May 19, 2013 at 08:19 PM
Replace "Vector3 position" with "var position". (Which incidentally would work in C# as well.) Regarding the rest of the code, you should really use lowercase for variable names. Uppercase is for classes and methods.
Your answer
![](https://koobas.hobune.stream/wayback/20220613102539im_/https://answers.unity.com/themes/thub/images/avi.jpg)