void OnCollisionEnter (Collision hit)
Use “Collision” not “Collider”.
Also you ended the class early, one bracket needs deleted / moved to the bottom of the script, right above your OnCollisionEnter () method.
Edit:
Edit 2: one last thing, it’s a bad idea naming a script “gameObject” since the local reference to gameobjects is the same name.
Consider yourself helped.
that dont work try it that way first before just copying and pasting from unity tutorals
Ummm… what? What didn’t work?
I didn’t “just copy and paste” anything, except an excerpt about OnCollisionEnter() to HELP you. Like you asked for? Anyway, I was thinking of OnCollisionEnter but I now see it was actually OnTriggerEnter, so Collider is correct in that part, but yeah you still gotta fix your brackets, the method can’t be outside the class like it is.
Copy and paste your script in text format and use code tags so I can further assist your vague question. Post any errors unity shows in the console
ok