Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *I wanted the game to quit once the player has collected all the object, and I didn't want the hud.* : in that case, don't use OnGUI, but check where the total is incremented. This happens at line 45, where the debug is :
- //Debug.Log( "A pokeball was picked up. Total Pokeballs = " + papers );
- if ( papers >= papersToWin ) // maximum total is reached, do something...
- {
- Application.Quit(); // loadLevel, whatever
- }
- *I added an instant reload trigger on contact* : always Debug to see what is happening in your scripts.
- function OnTriggerEnter (player : Collider)
- {
- // What entered the trigger?
- Debug.Log( player.tag + "(tag) " + player.name + "(name) has entered the trigger of " + gameObject.name );
- if(player.tag=="Player")
- {
- Application.LoadLevel(Application.loadedLevel);
- }
- }
- make sure the conditions are met to be able to use triggers : http://docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html
- **Notes:** Trigger events are only sent if one of the colliders also has a rigidbody attached.
- Apart from that, it is impossible to provide any more help : *I actually managed to get it to work.* So this question should be closed.
- Please ask a new question (preferably in the forums, as UA is broken and I don't receive notifications), with information regarding : the setup; scripts; desired behaviour and current behaviour. Good Luck with your project.
- Edit : dammit, now the simple act of formatting text for italics and code doesn't even work. UA is totally broken....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement