I have the following script:
float distance = Vector3.Distance(target*.transform.position, transform.position);*
if (distance < 10)
{
int layerMask = 1 << 8;
layerMask = ~layerMask;
RaycastHit hit;
if (Physics.Raycast(transform.position, target*.transform.position, out hit, distance, layerMask))*
{ debug…
The script works perfectly until I add either “distance” (on a number instead of the word) or “layerMask” . If I remove both terms and stop the line after “out hit” it works just fine.