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"

Spawn pawn from widget (multiplayer)

When my game starts I open a widget with buttons for types of characters. What I want to do is press a character button which spawns a pawn of that character in the level. However, I read that I shouldn't do spawning logic (and in the future possessing) in the widget. So I created an event in the Game Mode which will spawn a character in the world, however, I want this to work with multiplayer and I read that clients can't access the game mode. How do I get around this problem? Is there somewhere else I should be doing the spawning logic?


Select character buttons alt text

Spawn character pawn logic in GameMode alt text

Product Version: UE 4.21
Tags:
ue4-help-14.png (643.3 kB)
ue4-help-15.png (155.6 kB)
more ▼

asked Feb 18 '19 at 04:54 PM in Blueprint Scripting

avatar image

JustNatBros
5 1 2

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

2 answers: sort voted first

Yes Widgets can't be replicated and the GameMode only exist on the server so you need another replicated Actor to execute a RunOnServer Event. The PlayerController or a Possessed Pawn can be used for this or any other replicated actor spawned by the server owned by the client PlayerController. When the button is pressed you use the PlayerController/Pawn/ClientOwnedReplicatedActor to execute the event on the server and that should be it.

more ▼

answered Feb 18 '19 at 07:21 PM

avatar image

GarnerP57
961 3 4 8

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

In the widget Blueprint under Class Default, did you see under the Replication?alt text

h1.png (29.9 kB)
h2.png (31.7 kB)
more ▼

answered Feb 18 '19 at 05:27 PM

avatar image

Blackforcedragon
0 3 8 12

avatar image GarnerP57 Feb 18 '19 at 07:23 PM

UserWidgets don't inherit from the Actor Class and therefore can't be Replicated.

(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