I am trying to make the character fire some waves through the weapon when you click the mouse button, but somehow the waves (projectiles) are not showing in the screen even though the hierarchy shows that its being cloned. I'm new to Unity so I don't understand what's the problem.
This is the code I'm using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class weapon : MonoBehaviour
{
public GameObject projectile;
public Transform shotPoint;
private void Update()
{
if(Input.GetMouseButtonDown(0)){
Instantiate(projectile, shotPoint.position, transform.rotation);
}
}
}
I'd be thankful if someone can help me.
I would try what Sven Viking suggested, but also check the order in layer of the bullet clone. Sometimes it might just be hidden behind another object or the background. Additionally, try setting the speed of the bullet to 0, it might just be that the bullet is moving too fast.