problems CS1519, SC8124 somehow all errors are in one line,pls help( if(int collisions) = 1f; )

Please use code-tags when posting code.

The above mentions one of your many problems; the code above has so many problems that I think it’s worth suggesting that you follow some basic C# and Unity Scripting tutorials before proceeding.

This looks like you’ve just hacked an OnCollisionEnter as it takes a “Collision” and typed it wrong as a Trigger callback with spelt with one g!

void OnTrigerEnter(Collision hit)

You also then managed to type it correctly here:

private void OnTriggerEnter(Collider other)

This is completely pointless, you only get callbacks when the selected layers contact; you set this in the Physics settings!

if ((layerMask.value & (1 << other.transform.gameObject.layer)) > 0)

This is completely invalid code. This is not how you compare a value:

if(int collisions) = 1f;
1 Like