Notifications
Clear all

Access User Data

5 Posts
2 Users
0 Reactions
930 Views
(@mazen)
Posts: 13
Eminent Member
Topic starter
 

Hi 

i need to Access User Data ( coins ,  etc) to display them in ugui .

Thanks

 
Posted : 18/03/2015 3:13 pm
(@mazen)
Posts: 13
Eminent Member
Topic starter
 

ok now i can Access User Data but i can't modify them

if (CBManager.instance.isAuthenticated)
{
user = CBManager.instance.loggedUser;
MyUser myUser = user as MyUser;

myUser.Coins -= 10;

CBManager.instance.loggedUser.Update();
}

the error :

InvalidCastException: Cannot cast from source type to destination type.

NullReferenceException: Object reference not set to an instance of an object

 
Posted : 19/03/2015 2:21 am
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

May be you forgot to use the correct override of Login? If you take a look at the demo scene, it calls:

CBManager.instance.Login<MyUser>(loginUsername, loginPassword);

If you don't use this override of Login, then the default one is creating loggedUser with the basic class CBUser so you will not be able to cast it to your MyUser class.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 19/03/2015 10:27 am
(@mazen)
Posts: 13
Eminent Member
Topic starter
 

Thanks for support , now i can Access user data very smooth , Combu is great solution for my project ( five star not enough).

 
Posted : 19/03/2015 2:36 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Great you succeeded!

Have fun! :)

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 19/03/2015 2:37 pm
Share: