- Home /
Instantiating Prefab error C#
Assets/scripts/Explosion.cs(13,66): error CS0119: Expression denotes a type', where a
variable', value' or
method group' was expected
go = (GameObject)Instantiate(Resources.Load("cube_wall"),Vector3(5,5,5),Quaternion.identity);
But if i do the below it's fine. Why? Also, with the below code since i am not specifying the vector. How does it know where it will instantiate in the world?
go = (GameObject)Instantiate(Resources.Load("cube_wall")
Comment
Best Answer
Answer by duck · Oct 12, 2010 at 08:47 AM
This is occurring because - in c# - you need a "new" keyword before "Vector3".
So, your corrected line should look like this:
go = (GameObject)Instantiate(Resources.Load("cube_wall"), new Vector3(5,5,5), Quaternion.identity);
Oh, you're right! That was a mistake. (fixed example now)
Your answer
Follow this Question
Related Questions
Multiple prefabs in game scene 1 Answer
Font attach to Prefab 1 Answer
How to set a default prefab on a C# script? 1 Answer
spawning rigidbodies next to each other 0 Answers
Hi,a Problem When I Save a Prefab 0 Answers