- Home /
Question by
Lumind · Apr 12, 2014 at 12:03 PM ·
c#errorinstantiatevector3
Instantiate object in C#
I have these lines in my code
Instantiate (Cube_Transform,Vector3(posx,posy,posz), Quaternion.identity);
Instantiate (build,Vector3(posx,posy+0.525f,posz+0.6f),Quaternion.identity);
It works in Java. But now I convert my game to C#. I tried to convert in online converter (Js->C#). But it doesn't change these lines. And it gives errors
Comment
Best Answer
Answer by Jun Hin · Apr 12, 2014 at 12:23 PM
Instantiate (Cube_Transform, new Vector3(posx,posy,posz), Quaternion.identity) as Transform;
Instantiate (build, new Vector3(posx,posy+0.525f,posz+0.6f),Quaternion.identity) as Transform;
almost works) just without " as Transform" (but maybe it's because "Cube_Transform" and "build" are public Transforms already) but thanks, that helped:)