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"

Spawning Actor on Key Press doesn't work, but Is Input Key Down Does?

Hey guys! So, I am working on a little project that'll require a shield to spawn at the location of the player. I first checked to make sure that "Block Input" was Not Enabled in my Default Settings, and then tossed in this Blueprint. I checked out a lot of videos, and these Blue Prints always seemed to work, but it isn't working for me. Whenever I click "F", nothing Spawns even though I have the Shield Selected for the Class on Spawn Actor.

If I drag the "Pressed" for "F" to the Print String, that doesn't work either. However if I drag "True" on the "Branch" to the Spawn Actor and click on "F", that works, but it spawns too many Shields.

I saw in some videos that people used "Get Player Character" Node, but whenever I try using that, I get "Accessed None", but I don't think I need it because "GetActorLocation" with it Targeting Self does return the correct Location.

I just don't know if I am missing something or if I did something wrong somehow? alt text

Product Version: UE 4.19
Tags:
blueprint.jpg (112.5 kB)
more ▼

asked May 16 '18 at 07:22 PM in Blueprint Scripting

avatar image

UchihaKite
3 1 2 7

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

1 answer: sort voted first

I guess I'd go through a checklist:

  • Is PIE in focus when you start it (click the play area with mouse if it does not autofocus)

  • Is game paused and is the input registered when game is paused

  • Is input mode Game Only / UI only / Game and UI

  • The Pawn / Character and the PlayerController relations are set up correctly

Enable input may not be needed, but it is impossible to tell the context in which you are working.

Another issue might be that spawning a box at actor's location may not work if it ends up colliding with something.

more ▼

answered May 16 '18 at 09:42 PM

avatar image

JoSf
208 1 6 8

avatar image UchihaKite May 16 '18 at 09:58 PM

I'm still new to the whole Unreal Engine 4 thing, but I will try my best to go through this Check List.

"Is game paused and is the input registered when game is paused"

Input for "Is Input Key Down" does not register when the Game is Paused.

"Is input mode Game Only / UI only / Game and UI"

I'm not entirely sure what you mean by this, or how to check, but I'm pretty sure the Input Mode is for Game Only since I don't have any UI Elements.

"The Pawn / Character and the PlayerController relations are set up correctly"

I think so since the Blueprints to Print out the Debug Text uses the Player Controller and it works just fine.

"Is PIE in focus when you start it (click the play area with mouse if it does not autofocus)"

I'm not sure what you mean by PIE, but I do have to click the play area with my mouse when I start up the project.

Edit: I don't think it is a Collision Issue. Because when I connect the Branch Node to the Spawn Actor Node, it works just fine at Spawning the Shield. It just spawns like ten of them instead of one. It just doesn't seem to register when I click "F" using the Key Node or whatever its called.

In other words, it works when I do this (See Image Attached) but it just spawns too many Shields, and I know that it isn't the correct way to utilize key inputs (see second image)alt text.alt text

blueprint2.jpg (113.0 kB)
result.jpg (103.7 kB)
avatar image JoSf May 16 '18 at 10:15 PM

PlayerControllers possess pawns or characters (which derive from pawn class) with 1:1 relation.

For every level, there is GameMode, which defines PlayerController being used as well as the Default Pawn.

Assuming you use default editor layout, click on the toolbar above 3D viewport. Under Blueprints -> Project Settings, hover over GameMode, and see what it is set to. If you are in a blueprint project, you can set up the default playercontroller and the pawn directly. If you are in a C++ project, create a new GameMode blueprint and set it as the default gamemode.

Make sure that both the playercontroller and the pawn are set to what you want them to be.

avatar image UchihaKite May 16 '18 at 10:18 PM

I believe this is what you're talking about. Right? :Oalt text

gamemode.jpg (32.0 kB)
avatar image JoSf May 16 '18 at 10:28 PM

Yes.

The reason why the options are greyed out is because the current GameMode is based on C++. In order to make changes to the default pawn class and the player controller class, you'd either have to do it in C++, or, the easier way, is to create a new GameMode blueprint and set it as the default GameMode.

Then you can access the options which are now greyed out.

avatar image UchihaKite May 16 '18 at 10:34 PM

You sir, are a champ! Out of all the links I checked, you are literally the first person to make that suggestion! It works just fine now :D Thank you for taking the time to help me out man!

(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