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"

What is the proper way of replication a non-owned actor?

I have a problem with how to properly replicate an actor that is directly placed in game from editor. For example it is street light that i want to toggle using characters. From what i discovered i can't call RPC method on the Server directly from this street light, because I'm getting this kind of warning: "No owning connection for actor ...". From what i understand this is because my client player controller is not the owner of this actor. So what is the proper way to resolve this kind of problem in UE4?

Product Version: UE 4.13
Tags:
more ▼

asked May 04 '17 at 01:10 PM in C++ Programming

avatar image

fanaticguy
6 1 2 5

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

I think you are looking for NetMulticast

NetMulticasts execute the behaviour on the server and all connected clients, even if the Actor is not owned. You only have to fire the NetMulticast from the server for this to work.

You can read more about that here

more ▼

answered May 04 '17 at 09:30 PM

avatar image

DennyR
1.1k 31 12 47

(comments are locked)
10|2000 characters needed characters left
more ▼

answered May 05 '17 at 10:36 AM

avatar image

TheJamsh
795 55 89 136

avatar image DennyR May 05 '17 at 01:32 PM

Well, I posted there too, just to say that NetMulticasts work just fine.

https://i.gyazo.com/e558c300ae596eb533a088cf6e530306.mp4

(comments are locked)
10|2000 characters needed characters left

The problem is as the error says, you need to make sure that the actor is owned by something that can replicate.

A simple way would be to have the street light be spawned by the GameMode when the game is starting so the street light has a owning connection with the GameMode. If the street light is set to replicates, you should be able to interact with any of the pawns in the map.

more ▼

answered May 04 '17 at 02:03 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 17 127

avatar image fanaticguy May 04 '17 at 02:24 PM

Ok, but what if I want this street light to be placed manually in editor so I can easily manipulate this without changing the position of it in code?

avatar image ImVawx ♦♦ STAFF May 04 '17 at 05:38 PM

I would create a "street light spawner" that has the orientation and position of where you want to put the street light (what you place when in the editor) that the GameMode (or whatever) can then use to spawn the Street light Actor at.

avatar image fanaticguy May 04 '17 at 09:00 PM

I understand that there is no better way to solve this kind of problem?

avatar image ImVawx ♦♦ STAFF May 04 '17 at 09:32 PM

This is best way that I have done in the past. You could however try a few things, such as having one of the clients "own" the street light so it can replicate back and forth.

You could also try setting the owner to itself (from the server side), see if that does anything.

Realistically though, in order for the replication calls to succeed, they need to have a owning actor and be coming from an actor that is replicated. I have found the most straight forward way to achieve both of these is to spawn the actors during run time, from the server side, and make sure the owning actor can replicate.

(comments are locked)
10|2000 characters needed characters left
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