I’m working on an assignment for a class, and I’m making a mockup interface design. The interface is made up of a series of nested spheres that rotate to create revolving menus.
I’m using unity 2.6 for this.
The problem I’m having is that once I make it past the opening menu screen, the second screen, a character selection screen, isn’t recognizing collisions on any of the objects. I’m getting no naming errors in the script, and the way I went about it is a switch statement copied over for each clickable element. If all the elements on the first screen work, and I have no errors, I don’t see why the objects on the second screen are not working.
Each statement has a print, so I can see what’s running when I click on it. The print statements don’t even show up beyond the first menu.
I need some help figuring out something to fix this. I’m not really all that handy with code, so I’m not sure where to begin on trying to solve this problem.
Yes, they have mesh colliders. They happen to be plane objects, and I thought that might’ve caused a problem, so I tried switching fro box colliders. No difference. I’m using a switch statement nested in an OnMouseDown(), yes.
If it’ll help, I can stick up a screenshot, and a short clip of the interface in action.
they are in the same scene, and all the menu objects are children of a master sphere. I click ‘story’, it rotates the master sphere, bringing the next screen and set of options into camera view.
Thanks for the help, I really appreciate it. I’ve been on the IRC channel, and I can’t seem to get my instructor to respond to my emails. If this doesn’t work, my final doesn’t work tomorrow.
Without seeing the actual project, it’s hard to say what the problem might be. If you haven’t already though, you might add some debug statements (e.g. using Debug.Log()) to see if you can determine whether the problem is with the switch statement logic, or if the problem is that the OnMouseDown() function itself is not being called. (In general, add debug output wherever appropriate and see if you can narrow things down as to where the problem is.)
I don’t have debug going right now, but I have trace statements that should be firing when a collision occurs, and they’re numbered so I can track where I am in my code.
With that said, where would I insert a debug function? In the mouse down function?
Well, not specifically that, but close, yeah. MouseDown is being called, but for some reason it isn’t detecting collision on objects I click on after the first menu.
When I click the ‘story’ option on the main screen, for example, it get a trace indicating that story was clicked. But after the first screen, nothing is tracing back, but the mouse down is sending a trace out.