Hi, I’m relatively new to coding and I got a new error called “Error CS1022 Type or namespace definition, or end-of-file expected”? I don’t know what it means and other posts didn’t help me either.
(My code)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
public class FireBulletOnActivate : MonoBehaviour
{
public GameObject bullet;
public Transform spawnPoint;
public float firespeed = 20;
// Start is called before the first frame update
void Start()
{
XRGrabInteractable grabbable = GetComponent<XRGrabInteractable>();
grabbable.activated.Addlistener(FireBullet);
}
// Update is called once per frame
void Update()
{
}
public void FireBullet(ActivateEventArgs arg);
{
GameObject spawnedBullet = Instantiate(bullet);
spawnedBullet.transform.position = spawnPoint.position;
spawnedBullet.GetComponent<RigidBody>().velocity = spawnPoint.forward * firespeed;
Destroy(spawnedBullet, 5);
}
}