x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Mouse and Keyboard in "Play" mode does not work

Why when the game is paused, the input devices (mouse and keyboard) it working OK. But when it is in "play" mode does not work?

Product Version: Not Selected
Tags:
more ▼

asked May 17 '15 at 02:59 PM in C++ Programming

avatar image

Frankgrandson
11 3 6 7

avatar image Frankgrandson May 17 '15 at 09:33 PM

When my game is in PLAY MODE

MOUSE AND KEYBOARD DONT WORK.

When my game is in PAUSE MODE

MOUSE AND KEYBOARD WORK PERFECT !!!!!!

I dont understand why.

Please help me.

Thank you, best regards.

avatar image Frankgrandson May 17 '15 at 10:37 PM

In te PlayerController Constructor

 ABatallaPlayerController::ABatallaPlayerController(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer)
 {
     bShowMouseCursor = true;
     bEnableClickEvents = true;
     bEnableTouchEvents = true;
     bEnableMouseOverEvents = true;
     bEnableTouchOverEvents = true;
 
     DefaultMouseCursor = EMouseCursor::Crosshairs;
 }



avatar image Frankgrandson May 20 '15 at 05:59 PM

I change this:

 void ABatallaPlayerController::Tick(float DeltaTime) {
 
     if(WasInputKeyJustPressed(EKeys::A))
     { 
     
         int a = 100;
     }
     //EKeys::SpaceBar
 
 }

to this:

 void ABatallaPlayerController::Tick(float DeltaTime) {
     Super::Tick(DeltaTime);
 
     if(WasInputKeyJustPressed(EKeys::A))
     { 
     
         int a = 100;
     }
     //EKeys::SpaceBar
 
 }

And ALL is OK now. Thank you!!

Best regards.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

In my custom Player Controller Class I change the tick Funtion:

From:

 void ABatallaPlayerController::Tick(float DeltaTime) {
     if(WasInputKeyJustPressed(EKeys::A))
     { 
     }
 }

to:

 void ABatallaPlayerController::Tick(float DeltaTime) {
     Super::Tick(DeltaTime);
 
     if(WasInputKeyJustPressed(EKeys::A))
     { 
     }
 }

Now everything is OK. Thank you, best regards.

more ▼

answered May 20 '15 at 08:59 PM

avatar image

Frankgrandson
11 3 6 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hello, Frankgrandson

Please make sure that your Player Controller class is selected as Player Controller class in your project.

To do this, in the Editor you should go to Edit - Project Settings - Maps & Modes - Default Modes - Player Controller class.

Hope this helped!

Good luck!

more ▼

answered May 18 '15 at 08:34 AM

avatar image

Andrii Melnyk
1.9k 60 20 112

avatar image Frankgrandson May 18 '15 at 06:28 PM

Hi Andrew Melnick,

Thanks for reply.

This is the GameMode constructor:

 ABatallaGameMode::ABatallaGameMode(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer)
 {
 
 //    DefaultPawnClass = NULL;
     DefaultPawnClass = AMyPawn::StaticClass();
     HUDClass = AMyHUD::StaticClass();
     Juego = new game();
     // use our own player controller class
     PlayerControllerClass = ABatallaPlayerController::StaticClass();
 }

This is the player Conroller Constructor:

 ABatallaPlayerController::ABatallaPlayerController(const FObjectInitializer& ObjectInitializer)
      : Super(ObjectInitializer)
  {
      bShowMouseCursor = true;
      bEnableClickEvents = true;
      bEnableTouchEvents = true;
      bEnableMouseOverEvents = true;
      bEnableTouchOverEvents = true;
  
      DefaultMouseCursor = EMouseCursor::Crosshairs;
  }

This is the configuration screenshot:

alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Any suggestions?

more ▼

answered May 19 '15 at 04:43 PM

avatar image

Frankgrandson
11 3 6 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

What I should do?

I changed everything I could and nothing happens.

more ▼

answered May 20 '15 at 12:30 AM

avatar image

Frankgrandson
11 3 6 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

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

Answers to this question