Spawn an actor doesn't replicate if spawned by another blueprint

I want to spawn a projectile on server and that projectile is replicated but this doesn’t work if there is a intermediate blueprints and I’m wondering why.

here is basic WORKING example ( client request replicated projectile to spawn, server spawn it, both client and server can see projectile):

now, instead of directly spawning projectile I first spawn a blueprint Spell which has a property with caster Player and a method “Spell Released” who will then spawn projectile.

I attach an event handler (on click I call “Spell Released” method of my spell blueprint)


and finally actual spawning:

now wierd part is that if Server press button, everything works fine, but if client press it then client see projectile while server does not!! (and server spawned it!).

can you give me any advice? thanks!

if from latest blueprint, I get caster and call TestServer1 Event (event on player) everything works fine, so to me looks like a bug with setting ownership of an object

Hi MaxiHori,

Run on Server RPCs can only be used by Client if Actor is owned by that Client. By default, this is limited to Client’s Player Controller, Character, and Player State.

Here’s some documentation on that topic:

Hope that helps!

this seems to be problem, but I don’t really get how to solve it.

I did set owner of spawnactor method to “Caster” and caster is player controller who owns that class.

What did I miss?

I can’t see everything that’s going on with images you provided. Who is spawning spell book? If you can give me images of entire chain, including class of Blueprints they’re in, I might be able to debug problem. As is, my only guess is that something in that chain is not owned by Client, so whatever it spawns is also not owned by Client, so even if you declare ownership on something late in chain it won’t register.

last 3 images contains entire chain, first 2 are within player blueprint (Spell_1_RM is a property of player) and last one is within spell blueprint (which inherit a base blueprints that doesn’t do anything).

I also tried to set owner of first spawn (Spawn BaseBolt in second image) to self → get controller
but I have still same problem :frowning:

btw by looking at documentation it seems that without a proper owner event will be executed only in server, but I have opposite behaviour. client is only one who can see spawned projectile (and server spawned it!!)

I uploaded project at this link: Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

with “player blueprint” I mean Player Controller, but code in first image with a test function is in player controller too but it works and in documentation it says that it is correct to place it here.

By “player blueprint”, are you referring to Player Controller or Player Character? If it’s Player Controller, that would explain why it runs on your Client but not Server; Client’s Player Controller only exists on Client, so it can’t properly communicate to Server.

I might need to see this in a test project, if you wouldn’t mind putting something together. There’s a fair amount of information I think I’m missing here, and it’s easier if I can see it.

Thank you! good night :slight_smile:


Everything is in Player Character (FirstPersonCharacter) Blueprint in this project. You’re using base Player Controller with no modifications to it, according to your GameMode. So that explains why it’s working in first image, and eliminates that as a potential cause of problem.

I’ll take a closer look in morning and let you know what I see. Thanks for your patience.

any news? :slight_smile:

Hey there,

I looked on your project, there are some “issues” in spell actors, which does not marked as replicated and always relevant and variables like current spells don’t replicated as well. Also some events don’t marked for run on server but those shouldnt affect base logic. Even after fixing that, i dont know, without further investigation, why it’s doesn’t work. What i can say, its might be a really weird bug with your exact blueprint or logic issues somewhere, so i recommend you to recreate functionality in new BP. This is not a general unreal bug, because i have exact same system in development, mine is a lot further take, with buffs and stuff, now even more(this video is month old), but
your idea of spawning actors as a spell and making childs for new spells is legit, thats how i did mine.

Few “pro tips”:

1)Less casting more interfaces(for stability).

2)Main logic is not on events but on functions which triggered by those events(like that) and functions should have some return, so when you overwrite them, they put nicely into function list (for easy bug fixing and parent class developing)

3)Something else, but i forgot while typing, so if you have any questions, you can send them on forum via private message.


rest of project is just a prototype.

According to documentation that I have read it should work, either Im missing something or there is a bug. I’ve spent hours on this problem but I can’t figure it out.

it is too strange cause it is spawned by server but server don’t see it!

yes, i know

thats why i recommend you to recreate this functionality and stop spending time debugging.

Hi MaxiHori,

Well, you’re only able to declare ownership on Server, so that’s part of problem. But even after adjusting project you linked me to and my own test project, I can’t get Run on Server to run on Actors after Ownership is properly set. I’m going to investigate a bit further and enter a bug, and I’ll update this post once I have.

I can tell you, however, that there is a much simpler and more efficient way to handle this functionality. I would recommend creating a single spell casting actor in level, making it Server’s by default. Then have character ask Server to run Spawn event on that Actor. Here are a couple screenshots that hopefully help explain what I mean:

Character Event Graph:

Spell Casting Actor (in level):

With this method, you can simply reference Actor that spawns spell from Server with a single call, and you don’t have multiple instances of that Actor with multiple owners.

I just noticed I created that in 4.8, but converting it to 4.9.2 still works with this setup. If you’d like a copy of test, let me know via PM on forums and I’ll upload it somewhere for you.

spell that I’m passing is a base class for all spells. Each player must istance his own version of spell and add it’s custom properties which in turns will change spell behaviours.
I don’t think that your setup will work in my case and I really like my current setup cause it will became usefull later on.
if you can please submit a bug ticket maybe it will just be fixed for time I will finish some other parts of project :slight_smile:

thank you very much for your assistance.
I don’t really understand “declare ownership on server” part, do you mean like passing Caster Controller to server method and use that to assign ownership at server side? and how do I “pass information to correct character”? isn’t that already be done by spawning a replicated projectile?

If your method is better I’d like to use that, but I’m not really sure how to properly set it up. would be too much to ask for a small working example?

I tried to create everything from scratch, and I ended up with:

  1. player character: now it just contains a Blueprint Component and key bindings to use that

  2. SpellManager Blueprint Component who handles spellbar and Spawn istance of ABaseBolt (which inherits ASuperSpell)

  3. ABaseBolt will spawn Projectile (which is replicated)

This seems correct setup to me, what do I need to change to move from here to your setup? anything that I did wrong?

this is really appreciated thank you very much.

if it weren’t for spawning projectile, ABaseBolt would be a normal class and not even an Actor. do you think that I should keep it as an actor or just a normal object?

Okay, there does not appear to be a bug.

First, you need to declare ownership on Server. Second, actor you’re declaring ownership on must be set to Replicate.

If you set your system to pass appropriate Character reference to apply ownership on Server and then pass information to correct Character, your setup will work. Let me know if you need me to upload my adjustments to your test project somewhere so you can see it.

Again, this isn’t a terribly efficient way to handle this situation. Restricting ownership is done for both network efficiency and to prevent possible cheating on part of Clients. setup I described above can work as long as you’re willing to create necessary functions and pass necessary values to make it work. It’s certainly up to you, but that’s why ownership works way it does.

sorry but I really don’t get it :frowning:

I don’t understand why I should spawn and replicate an ABaseBolt blueprint.

I mean, why server needs to know it? it wont affect other players even if you try to edit it by cheating.
at end ABaseBolt just contains a list of effects that projectile need to apply when hitting something (and maybe later on spell icons, etc…).
isn’t then just spawn of projectile that need to be checked by server?

thing that confuses me most is that I already pass a Caster reference to server event when spawning projectile, but server event simply never get hit. I have a client, I call from client a server event, call start but server event never get called.
But according to your solution if I do same thing at ABaseBolt level it will work, why?

sorry but I’m really tring to understand how it works but I’m having a lot of difficulties :frowning:

It means you would want to spawn actor on server, same as you would projectile. If you pass a reference to character through Run on Server event that spawns actor, you can use that reference to set owner. Since actor is being spawned on Server in this case, owner is being declared there as well.

Similarly, if you spawned actor anywhere and then on that spawned actor used Set Owner node, you would want to do that on Server instance of that actor.

I know that can be complicated. Networking is a bit difficult to follow sometimes. In your sample project, it would look like this:

Here, I’m separating what occurs on Server (Authority) and Clients (Remote). On Server, we just want to spawn ABaseBolt actor (which is set to Replicate) with Self as Owner. This is declaring Server Character as this instance of ABaseBolt’s owner.

We do same basic setup in a custom event that is set to Run On Server, so that Remote Characters each create their own ABaseBolt and immediately declare ownership of it with Client’s Character (thus Character reference input in event). Remember this is happening on Server’s instance of Player’s Character:

Finally, after running custom event on Clients, we get every reference to ABaseBolts in level and find one that is specifically owned by character, and set Spell1RM variable to it. We’re doing it here instead of after spawning it so we can make sure correct Character is getting correct reference:

If you want to have an instance of class in a level, you need an Actor based on it to properly reference it. You could maybe do this as an Object, but I’m not 100% on that.