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"

The game always spawns the default character even when I selected a different one. How to I fix this?

So I'm trying to make a character selection screen in my game, and I have many different levels in my game and I don't want a character select screen to pop up every time the player goes into a new level. This is what I have so far. The first image is of my character select widget, each of the character buttons are represented as an int. The second image is of the level blueprint. In the Level blueprint, it's using the int given from whatever button was pressed in the character selection screen and spawning in the character selected. That's how it should work, however, no matter what character is selected it automatically chooses the first one. alt text alt text

Product Version: UE 4.19
capture1.png (669.8 kB)
capture.png (444.8 kB)
more ▼

asked Jul 06 '18 at 04:17 AM in Blueprint Scripting

avatar image

3 1 2

avatar image xadamxful Jul 06 '18 at 11:54 AM

Are there any pawns in the level with auto posses turned on? Or a game mode set in world settings with a default pawn class?

avatar image xadamxful Jul 06 '18 at 12:02 PM

Also make sure the character selection is made before that level loads up because the character is spawned on EventBeginPlay so the selection has to be made before the level has been loaded.

avatar image Cwesolo Jul 06 '18 at 08:28 PM

The Character Select screen is in the main menu, so it's before the level is even loaded. And the game mode is set to none for the character

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

1 answer: sort voted first

The issue is most likely in your Event BeginPlay. You are spawning in the character based on your int as soon as the widget is spawned in. Change the BeginPlay event to a custom event that you call when one of your character selection buttons is pressed to change the int before you spawn in a character.

EDIT: To test if this is the issue try changing the default value of CharChosen and see if a different character is spawned in.

more ▼

answered Jul 06 '18 at 06:24 PM

avatar image

33 1 4

avatar image Cwesolo Jul 06 '18 at 08:31 PM

The Character Selection screen is in the main menu so it's before the level is even loaded. So the screen isn't being loaded when the level loads. For some reason when the level loads it always goes to the first thing that's on switch on int.

avatar image iArchaea Jul 06 '18 at 08:45 PM

Try adding print statements 1) where you set the int and 2) where the switch is called. In both places have it print the int value. This should tell you whether the issue is with the set or get functions. Lmk what you find out!

avatar image Cwesolo Jul 07 '18 at 03:07 AM

So I tested what you said and on my character select screen, it seems that the only button that seems to work is the first one which is why it's spawning only spawning in the default ball. I'm going to to try resetting the buttons on clicked event and see if that fixes the issue.

avatar image Cwesolo Jul 07 '18 at 03:11 AM

So it seems that I just needed to reset the on clicked event for each of the buttons, Thank you so much for your help its much appreciated. I'm going to mark this answered unless something else happens to come up with the character selection screen again.

avatar image iArchaea Jul 07 '18 at 05:57 PM

Great to hear this is fixed! Glad to help

(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