Hello, I’ve setup a login system in blueprints for my game, and what it does is when someone logs in successfully it stores their username that they’ve typed in into a GameInstance blueprint.
They then get transferred to a different level, which will spawn a character for them to possess. This all works, but my question is, how do I now set variables per spawned character…
On event begin play for these spawned actors, I request the Username from the GameInstance blueprint and set it as Username, however… this replicates for every spawned character client-side.
For example I’ve set it up so that when you click on an actor it will print out the set username variable, but it doesnt matter on which character you click, you will always get your username in the printed string.
Even setting the username variable to replicated or repnotify doesn’t work…
I’ve tried to figure out how to do this four hours but I’m stuck and Im hoping someone here can help me because the AnswerHub seems to ignore my questions regarding replication.
Thanks in advance.
Each actor holds its own set of variables, if I have two of the same actor, each will hold unique values to the same variables.
The username variable is applied to every instance of the spawned actor, I want to make it so that you only get your own name when clicking your own character… not someone elses…
Setting this variable to replicated or repNotify doesn’t seem to do the trick…
Struct and data tables to manage variables.
you can store character name in character bp after player posses an actor and grab them from there on click.
im new to ue but you can add me on skype, so we can learn blueprints together
Okay so that sets the charactername for the TopDownCharacter initially, but my problem is this:
When client 1 then clicks on client 2’s TopDownCharacter he doesn’t get client 2’s version of the characterName variable from the TopDownCharacter… instead, he gets his own… (replicated/repNotify both don’t work)
i dont understand how this can even happen
lets say you have an array of names
when character spawn this char grab name from this array and remove this from array of available names
after that onclick event grab name from a clicked actor and show on your screen
add me on skype for more.
Managed to solve this issue by doing this in the TopDownCharacter blueprint.