|
I have created a prefab cPrefab. I have declared a public GameObject gamePrefab in the script. To make it visible, I dragged the prefab over to the gamePrefab displayed under the script section displayed in the inspector. When I try to Instantiate, I get the error "the name "cPrefab" does not exist in the current context. How do I make the prefab accessible so I can Instatiate it?
(comments are locked)
|
|
public GameObject ob; public Vector3 position; ... GameObject.Instantiate(ob,position); ... You use variable names in scripts, not object names. Sounds like you're trying to Instantiate(cPrefab) when your script has nothing called 'cPrefab'.
(comments are locked)
|
