Hello everyone
I’m trying to do my own whack-a-mole kind of game. I made an array of Vector3s with possible positions and randomising them to Debug.log works fine. I have an error though, when I try to use the random position when instantiating my prefab. Here’s my code:
using UnityEngine;
using System.Collections;
public class pojawia_w_miejscu : MonoBehaviour {
public GameObject zombiePrefab;
pozycje pozycja = new pozycje();
void Update ()
{
if(Input.GetKeyDown(KeyCode.A))
{
Object zombieInstance;
zombieInstance = Instantiate(zombiePrefab, pozycja.positions[Random.Range(0, 8)]);
}
}
}
And here’s an error:
No overload for method ‘Instantiate’ takes ‘2’ arguments
Pozycje is the class that has an array storing possible positions.