Samuel Breese
Samuel Breese

Reputation: 714

UDK GameReplicationInfo relating to GetPC()

I'm writing some code that uses a class to interact with a matchmaking server using TcpLink. Since I need to access a single reference to an object of this class throughout the code, I've been saving a reference to the object in the PlayerController class and accessing it throughout the program using the function GetPC. My question is, is it safe to call this function in a subclass of GameReplicationInfo? If it isn't possible, then what are my alternatives for inter-class data transfer? The class instance needs to be accessible from a variety of different places, including instances of GFxMoviePlayer, PlayerController, and, most of all, GameReplicationInfo itself.

Upvotes: 0

Views: 452

Answers (2)

Allar
Allar

Reputation: 140

If the object only needs to be accessible from the local player, storing a reference and accessing only the reference in a local player controller should be fine and is a far better solution than config files. Be sure to always use the local player controller, and you shouldn't expect retaining your object after level/server switching or connecting. I've done a Tcplink matchmaking server myself to know that 1) Eventually you should plan on combining tcplink with your own class pulling from an online subsystem and 2) the player controller approach will work in the mean time.

Upvotes: 2

Samuel Breese
Samuel Breese

Reputation: 714

Sigh, no answers. I think I'm just going to go with saving values in a config file, because speed isn't really of the essence.

Upvotes: 0

Related Questions