Forum C# Constructors are protected in all of PlayerIOClient classes

Constructors are protected in all of PlayerIOClient classes

Postby KaanGaming » June 5th, 2018, 8:07 pm

This question is related to PlayerIO and C# as well.


Hello there! I am coding a game, but for some reason I can't create instances of these classes (Client, ErrorLog, BigDB, etc.).
I looked at these codes, and I saw these constructors are protected.

I tried to create an instance, but I failed.
Code: Select all
public static Client client = new Client();

This is the part of code which has error. When I make them null, it works perfect. But still, when I try to log an error, it fails. Because, instance is set to null.

Can I learn why the namespace PlayerIOClient's all classes' constructors are protected?
Posts: 2
Joined: April 25th, 2018, 2:12 pm

Re: Constructors are protected in all of PlayerIOClient clas

Postby Henrik » June 9th, 2018, 2:00 am

The constructors are protected, because you are not supposed to call the constructors.

The entrypoint into the client-side APIs is the PlayerIO class, it has a method called Authenticate, which returns an instance of the Client class which has all the permissions of the user you authenticated as. On that instance you can then access BigDB and PayVault and all the other services as that user.
Posts: 1819
Joined: January 4th, 2010, 1:53 pm

Return to C#