Question by
W4rdGaming · Feb 06, 2016 at 12:29 AM ·
ai problems
hi how can you get rid of this ? error CS1501: No overload for method `Instantiate' takes `2' arguments
using UnityEngine; using System.Collections;
public class Mechanics : MonoBehaviour { public GameObject enemyObject; // Use this for initialization void Start () { InvokeRepeating ("spawnEnemys",5,8); }
// Update is called once per frame
void Update () {
}
void spawnEnemys () {
Instantiate (enemyObject, new Vector3(11, (int)Random.Range (-4.25f, 4.25f)));
}
}
Comment
http://docs.unity3d.com/ScriptReference/Object.Instantiate.html
You're missing the rotation argument.
Answer by aoluser927 · Feb 06, 2016 at 05:15 AM
@LazyElephant is right, you need the rotation. Try this:
Instantiate (enemyObject, new Vector3(11, (int)Random.Range (-4.25f, 4.25f), Quaternion.identity));
Your answer
Follow this Question
Related Questions
COMPILER Error 0 Answers
Stop before player 1 Answer
how to search for a random point until the condition is true? 0 Answers
AI moving Backwards along path 0 Answers
How do I make an AI(cube) that follows and rams the player? 0 Answers