Question by
Xavierjv · Mar 28 at 11:36 PM ·
scripting problemspawnscript error
"InvalidCastException: Specified cast is not valid. (wrapper castclass)" ERROR
Hi, I'm trying to make a tetris game, and I'm getting this error in the spawn script
public class SpawnTetris : MonoBehaviour {
public GameObject[] Tetrominoes;
// Start is called before the first frame update
void Start()
{
NewTetromino();
}
public void NewTetromino()
{
Instantiate(Tetrominoes[Random.Range(0, Tetrominoes.Length)], transform.position, Quaternion.identity);
}
}
Comment
Your answer
Follow this Question
Related Questions
error CS1526: A new expression requires () or [] after type 1 Answer
StackOverFlowException: The requested operation caused a stack overflow 1 Answer
What's wrong with my script? 1 Answer
error CS0103: The name `yourCharacter' does not exist in the current context 1 Answer
How can I modify all gameobjects that have the same script just 1 time? 0 Answers