This question was
closed Jul 26, 2016 at 12:38 PM by
Anas173.
Help with error in unity.
Error CS1061: Type UnityEngine.Object' does not contain a definition for
GetComponent' and no extension method GetComponent' of type
UnityEngine.Object' could be found. Are you missing an assembly reference? (CS1061) (Assembly-CSharp)
Comment
Best Answer
Answer by jgodfrey · Jul 02, 2016 at 01:37 AM
I think the placement of your parens is off here...
Crate obs = ((GameObject)Instantiate(TypeOfObstacles[j], freePositions[pointsIndex].position, Quaternion.identity).GetComponent<Crate>());
Try this instead:
Crate obs = ((GameObject)Instantiate(TypeOfObstacles[j], freePositions[pointsIndex].position, Quaternion.identity)).GetComponent();
Follow this Question
Related Questions
I am trying to offset the camera from the player at all times even if the player moves. 0 Answers
error CS0201 1 Answer
GameObject has undefined tag! 0 Answers
Hello everyone I have a problem with rounding number of my score 2 Answers
How do you move the camera with the player. Whats wrong with my code? 0 Answers