Download

How do you create a network save name on a spawned object?

Okay so I have an info actor that I am spawning as a child actor of my pawn that I want to replicate only to it’s respective client. My original code was:


    

    FActorSpawnParameters spawnInfo;
    
    spawnInfo.Name = TEXT("CharacterInfo");
    spawnInfo.Owner = this;
    
    this->myInfo = this->GetWorld->SpawnActor<AMyInfoActor>(this->myInfoActorClass, spawnInfo);


however ALL my infoActors had the exact same name and thus when an RPC triggered on the client to the server it only used the first info actor spawned on the server.

I deleted the part where I set the name and that fixed the problem… but what would I do if I wanted to give a specific name and then have UE4 handle changing that name like it seems to do for actor components and other actors?

The upside is I can see this possibly being very useful information, if your actors have the same name on the server only one will be used in RPC and replication.

I posted this up at AnswerHUB but I’ve had absolutely no responses so if you know please respond there:

https://answers.unrealengine.com/questions/214242/edit.html

Do you need this name to be something specific or just unique? If it is the last one then UUID is probably a solution for your problem.

Well I was hoping that I could give it a specific name such as “MySpecialComponent” or “MySpecialActor” and have the UE4 System generate additional information to make it unique, like it seems to do if I don’t give it a specific name at all. However I am also completely okay with figuring out a method of doing this myself such as using the UUID and appending it to the name.