void OnTriggerEnter(Collider other)
{
if (other.tag == “AccessibleShip”)
{
if (!inShip)
{
CmdEnterShip(other);
}
}
}
[Command]
void CmdEnterShip(Collider other)
{
AccessibleShip hit = other.GetComponent<AccessibleShip>();
Destroy(gameObject);
GameObject ship = Instantiate(hit.tiedShip, other.transform.position, other.transform.rotation) as GameObject;
ship.GetComponent<Team>().team = gameObject.GetComponent<Team>().team;
ship.transform.parent = transform.parent;
Destroy(other.gameObject);
inShip = true;
}
}
Whenever I try to run this it says I need to fix the errors in my compiler even though none are thrown. When commented out the code works fine. The class is a NetworkBehaviour and it is the child of the local authority