Instantiate is not working in unity 5.6.4f1
Hello, I am new here in the forum, and created the account here because i cant make instantiate work. I am on windows 7 64 bits and using unity 3d 5.6.4f1 and the monodevolop that comes with it. And only using c# scripts.
I am using the default fps character, and tried to add a power up, when the player collides with it it allows the player to shoot bombs. I've created the bomb and the collision is working. I have other power ups (like jump, speed, etc) that are working and the collision is being detected.
But i want it to when i click with the left button of the mouse it instantiates a object, the bomb. I've tried everything in the web that i could find, and doesnt make any difference, the object never appear in the scene or in the hierarchy.
here goes one part of my code:
if (Input.GetMouseButtonDown (0)) { /GameObject bomb = Instantiate (prefabBomb) as GameObject; bomb.transform.position = transform.position + Camera.main.transform.forward 2; */ //GameObject bomba = Instantiate (prefabBomb); //Instantiate(prefabBomb); var newBomb = Instantiate(prefabBomb); }
all the commented lines are lines that i've tried before and didnt erease yet.