Hi im trying to make a gun that shoots but this error came up and im not sure how to fix it
Assets\Scripts\weapon.cs(39,134): error CS1503: Argument 1: cannot convert from 'float' to 'UnityEngine.Vector3'
this is my script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class weapon : MonoBehaviour
{
public float fireRate = 0;
public float Damage = 10;
public LayerMask NotTohit;
private float timeToFire = 0;
Transform firePoint;
// Start is called before the first frame update
void Awake()
{
firePoint = transform.Find ("FirePoint");
if (firePoint == null) {
Debug.LogError("No firePoint WHAT!!!");
}
}
// Update is called once per frame
void Update()
{
if (fireRate == 0) {
if (Input.GetButtonDown("ShootMain")) {
Shoot () ;
}
}else if (fireRate != 0) {
if (Input.GetButton("ShootMain")&& Time.time > timeToFire) {
timeToFire = Time.time + 1 / fireRate;
Shoot() ;
}
}
}
void Shoot() {
Vector2 mousePosition = new Vector2 (Camera.main.ScreenToWorldPoint (Input.mousePosition).x, Camera.main.ScreenToWorldPoint (Input.mousePosition.y));
Vector2 firePointPosition = new Vector2 (firePoint.position.x, firePoint.position.y);
RaycastHit2D hit = Physics2D.Raycast (firePointPosition, mousePosition = firePointPosition, 100, NotTohit);
Debug.DrawLine (firePointPosition, mousePosition);
}
}