roll the ball collecting cubes not working help
I am currently following the tutorial on the "roll the ball" game, I'm on the last step however the ball isn't collecting the cubes. is my code wrong? please help
Answer by faizabdo · Dec 20, 2016 at 07:29 PM
The game is working properly now! you both were right i didn't tag the game as i was suppose to causing the game to malfunction. Thank you both for the help, it is much appreciated @Thomas-Hawk @michelle12188
On the cube object, look for the collider component, it will be Box Collider probably, makes sure the checkbox next to "Is Trigger" is CHEC$$anonymous$$ED.
This is saying, that ins$$anonymous$$d of the collider defining the physical collisions, it is letting things pass through it and sending that information (as a Collider variable called "other") to the OnTriggerEnter script, that asks "If it's tagged as "Pick Up", set that object to be disabled, add 1 to your current count, and then update your text on the GUI by passing it through its own function which checks whether or not you've collected 12, and thus posts / enables the win text.
I didn't check the "is trigger" box for any of the cubes before, so as you stated I thought that might be the issue however now when ever the player comes in contact or touches the cube it pauses the game and now a error pops up saying "Pick Up is not defined" how do i fix that? @$$anonymous$$-Hawk
Pick Up was the name of your tag. I would guess this means you haven't actually created the tag. You need to go to the tag manager and create one and then assign it to the object you are trying to pick up.
Check this out for how to create the tag:
https://docs.unity3d.com/$$anonymous$$anual/class-Tag$$anonymous$$anager.html
Answer by michelle12188 · Dec 06, 2016 at 06:46 AM
Double check that you have the colliders and rigid bodies set up properly and that the tag on the pick up object is exactly the same as you wrote in your code.
Other than that unless you are getting any errors I would add some debugs to check what point the code is getting to.
Answer by Thomas-Hawk · Dec 21, 2016 at 05:33 AM
Make sure your cubes are tagged as "Pick Up", the case and space being important there.
Answer by faizabdo · Dec 06, 2016 at 09:26 PM
I checked for it multiple times and i even when back to the video to see his code however mine isn't still working its hitting into the cubes instead of picking them up. @michelle12188
If it is bumping into the object it sounds like you forgot to check the isTrigger option on the collider for the pickup item