- Home /
Instantiate Error (BCE0023)
Hey People,
I've been searching for about 2 hours for a solution, have checked and re-checked the example on the Unity Manual and look at a couple of example tutorials but to not avail.
I trying to create an object to appear multiple times and attach it to the scene manager. The code I've written so far looks like this
 //Enemy Counter
 var EnemyCounter : int = 0;
 //Variable for Random Y Co-Ordinate
 var EnemyY          : int = 0;
 
 //Variable created for Enemy
 var EnemyBody      : Transform;
 
 function Start () {
 }
 
 function Update () {
 
 EnemyY = Random.Range(-17,17);
 
 if(EnemyCounter == 0){
     Instantiate(EnemyBody, Vector3(20,EnemyY,0),0);
     EnemyCounter = 40;
     }
Yet I'm getting this error
BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.Transform, UnityEngine.Vector3, int)' was found.
Any help would be greatly appreciated
Answer by Piflik · Jan 03, 2013 at 02:14 AM
Just like the error says: the arguments you hand over to Instantiate are wrong. The last one has to be a Quaternion, not an int.
e.g:
 Instantiate(EnemyBody, Vector3(20, EnemyY, 0), Quaternion.identity);
Of course! I was thinking of rotation as a single number ins$$anonymous$$d of a 3 dimensional number. I knew that this would happen. Thank you for you help :-)
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                