- Home /
Instantiate not working
can anyone tell me why this code is no working?
Instantiate(NewCamPre,transform.position,transform.rotation);
I used in another project which works fine, just not in my other one. I get the following error:
Assets/Scripts/Launch.js(67,20): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(System.Type, UnityEngine.Vector3, UnityEngine.Quaternion)' was found.
Answer by whydoidoit · Jun 28, 2012 at 04:14 PM
NewCamPre appears to be the name of a type and not a variable containing a prefab variable.
Answer by MrSteve1 · Jun 28, 2012 at 08:30 PM
I had declared it earlier on in the script. It was var NewCamePre : GameObject;
This was before the Start(){ }
Still haven't solved it. Thanks anyway
Please use comments rather than answers :) there's an Add new comment button hidden on the right of the screen.
Well your error message says that NewCamPre is a type - do you perhaps have a script called that? If so change its name....