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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to spawn actor from client and replicate it?

I'm trying to learn some networking, I've watched the Unreal networking tutorials, but I still can't accomplish a very basic task:

If client presses a key to spawn an actor, it spawns and is visible on all other clients & server.

This is what I have so far: alt text

... But this works only when server presses the key - in this case it shows up in all clients. But when one of clients presses a key to spawn an actor, it shows up only on the client who presses it.

The 'Replicates' checkbox is checked on the spawned actor.

I feel like I miss something basic, maybe my brain really doesn't like networking :( Any clues?

Product Version: UE 4.12
Tags:
bez tytułu.jpg (84.8 kB)
more ▼

asked Jul 01 '16 at 05:53 PM in Blueprint Scripting

avatar image

Slavq
2k 156 153 206

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

2 answers: sort voted first

Here is how you should go for what you want to achieve:

  1. The client presses the key and call a server RPC function/event

  2. In this server RPC, you spawn the new actor

  3. It will be automatically replicated to other clients

In your actual blueprint, your Spawn It event should be a server event. Right now I think you setted up as a multicast event, which only servers can execute. That's why it only works on server.

Good luck !

more ▼

answered Jul 03 '16 at 10:30 PM

avatar image

NymKappa
697 31 20 54

avatar image Slavq Jul 03 '16 at 11:39 PM

Thanks! I've changed it to server event, but it still works only when server presses the key. Here is how it looks: alt text

When I press '2' on server, it spawns it and shows on both server and client. When I press '2' on client it does nothing. But the 'Hello' string works, so it responds to input correctly.

networkstruggle.jpg (102.6 kB)
avatar image CyberblastSoft Jul 04 '16 at 08:06 AM

Make sure you set the network ownership correctly on that actor of the blueprint you show

avatar image NymKappa Jul 04 '16 at 08:13 AM

Did you try to put this blueprint somewhere else ? Usually, this kind of network stuff is done in a PlayerController. I'm not sure if clients can do much on Level instances.

avatar image Slavq Jul 04 '16 at 10:34 AM

I've moved it out of level blueprint and it worked! :) So that was the cause, things like this won't work in level BP.

Thank you, +1's for you all!

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

Probably is Spawned, but on world location 0,0,0? I had the same issue.

more ▼

answered Jul 04 '16 at 05:39 AM

avatar image

Naitguolf
66 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