Convert line to C#

How to write

Instantiate(Resources.Load("Prefabs/Coin"),Vector3(0.16,3.0,-i*5),Quaternion.Euler(90f,180f,0f)) as GameObject; 

in C#.

1 Answer

1

You need an ‘f’ following any floating point number. You need a ‘new’ in front of the Vector3. The ‘as GameObject’ is only needed if you are assigning the result:

GameObject go = Instantiate(Resources.Load("Prefabs/Coin"),new Vector3(0.16f,3.0f,-i*5),Quaternion.Euler(90f,180f,0f)) as GameObject;

thanks a lot