x


Intercept keystrokes

I have a splash screen, that is displayed when the game is started. In the background the game loads the first level (or the last savepoint, if one exists) and opens the main menu. The menu is already active, albeit hidden behind the splash screen, but I want the player to not be able to interact with it or exit the menu.

Is it possible to intercept all player input, as long as the splash screen object exists? (it is destroyed automatically after a couple of seconds)

more ▼

asked May 02 '12 at 12:19 AM

Piflik gravatar image

Piflik
5.4k 15 26 44

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can't put a blanket disable on all inputs, however you can send signals to all the objects that should be listening for input, telling them to ignore them until the level is fully loaded. Try putting a boolean flag on your menu (and player) objects, that gets checked at the beginning of 'Update' (or OnGUI, if that's how your menu works), and if true either returns immediately or only executes essential (non-input based) functions.

Then, either use SendMessage to activate them once the splash disappears, or however you want to do that.

more ▼

answered May 02 '12 at 12:27 AM

syclamoth gravatar image

syclamoth
14.8k 7 15 80

Yeah...about a second after I hit the Ask Question Button I figured it would be the easiest to do this. And one additional if statement shouldn't affect the performance...especially for menu activities.

Thanks anyway.

May 02 '12 at 12:41 AM Piflik
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3727
x953

asked: May 02 '12 at 12:19 AM

Seen: 374 times

Last Updated: May 02 '12 at 12:41 AM