Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Weapon : MonoBehaviour
{
public Transform firePoint1;
public Transform firePoint2;
public Transform firePoint3;
public GameObject playerBulletPrefab;
public int playerShotNum = 0;
void Start()
{
}
void FixedUpdate()
{
if (Input.GetMouseButton(0)){
if (playerShotNum = 2){
Shoot();
playerShotNum = 0;
}else{
playerShotNum++;
}
}
void Shoot (){
Instantiate(playerBulletPrefab, firePoint1.position, firePoint1.rotation);
}
}
}
And for some reason, it keeps saying that line 22 ( if(playerShotNum = 2) { ) has the “Cannot convert type int to type bool” error. I am using the newest version of unity (V 2021.1.18f1), and no matter what I do, it just keeps popping up. Can someone please help?