How to do global variables in MULTIPLAYER?
I clicked through many previously asked questions about making global variables with blueprints, and the solutions worked just fine and dandy until I tried to add a second client. Below is my simple test project where I made an actor class named "GlobalVariableDatabase" and gave it one Visible, Replicated integer variable. It has one function that increments the int then prints the new value. I placed an instance of the class in the level to serve as the database for the clients. The clients themselves can press C to access the instance in the level and tell it to increment its integer variable. I started with the Third Person Example project; this is the only code I've added to it.
I booted it up and took control of Client 1. I incremented the database's int a few times.
I switched to Client 2 and expected (desperately hoped) that the incrementation would start right where it left off and say 5, but to no avail. The counter was still at 0 for Client 2.
Of course, when I clicked back to Client 1 and hit C it incremented to 5, as expected. The two clients are just incrementing the int completely separately. Not very 'global' in any sense.
So this is where I'm stuck. What am I doing wrong? How do I fix it? Is this completely the wrong approach or am I missing something really obvious?
asked Jul 11 '16 at 01:45 AM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here