I’m making a prototype bullet hell game, and i’m working on dropping/picking up weapons. But I get these 2 errors:
Assets\Scripts\Weapon.cs(22,46): error CS1001: Identifier expected
and:
Assets\Scripts\Weapon.cs(32,45): error CS1001: Identifier expected
The code is:
using UnityEngine;
public class Weapon : MonoBehaviour
{
public float throwforce;
public float throwextraforce;
public float rotationforce;
public int weapongfxlayer;
public GameObject weapongfx;
public Collider gfxcollider;
private bool held;
private Rigidbody rb;
private void Start()
{
rb = gameObject.AddComponent<Rigidbody>();
rb.mass = 0.1f;
}
public void Pickup(Transform.weaponholder) {
if (held) return;
Destroy(rb);
transform.parent = weaponholder;
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
gfxcollider.enabled = false;
held = true;
}
public void Throw(Transform.playerCamera)
{
if (!held) return;
rb = gameObject.AddComponent<Rigidbody>();
rb.mass = 0.1f;
var forward = playerCamera.forward;
forward.y = 0f;
rb.velocity = forward * throwforce;
rb.velocity += Vector3.up * throwextraforce;
rb.angularVelocity = Random.onUnitSphere * rotationforce;
gfxcollider.enabled = true;
transform.parent = null;
held = false;
}
}
I don’t know why it’s happening, but if someone would know the answer I would be really grateful.