#can someone help me fix this code?
1 messages · Page 1 of 1 (latest)
the code is
RaycastHit hit;
if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, Range))
{
Debug.Log(hit.transform.name);
animator.SetBool("Shoot", true);
new WaitForSeconds(1f);
animator.SetBool("Shoot", false);
TakeDamage Target = hit.transform.GetComponent<TakeDamage>();
if (Target != null)
{
Target.takedamage(Damage);
}
GameObject impactGO = Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal));
Destroy(impactGO, 2F);
new WaitForSeconds(1f);
What made you think this would do anything?
Also why wait in the first place?
If you have an animation you need to play only once, use a trigger, not a bool.
Okay thanks for all the feedback, and i just started coding and im not really sure about all of the coding
if you are new to coding, you should not be using unity right now