I’m getting the following compile error with a OnCollisionEnter script from the script reference page Here
**Only assignment, call, increment, decrement, and new object expressions can be used as a statement
**
For the life of me, I can’t figure out what it’s reffering to. I do know that the inspector does not ask for a transform to be selected for explosionPrefab.
Here is the script and thanks for any direction on where to look for an answer!
public class EnemyCollider : MonoBehaviour{
//Variables__________________
public Transform explosionPrefab;
//Variables End__________________
void OnCollisionEnter(Collision collision) {
{
ContactPoint contact = collision.contacts[0];
Quaternion rot = Quaternion.FromToRotation(Vector3.up, contact.normal);
Vector3 pos = contact.point;
Instantiate(explosionPrefab, pos, rot) as Transform;
Destroy(gameObject);
Debug.Log("I'VE BEEN !HIT");
}
}
}//end MonoBehaviour