Combu  3.2.2
Unity API Documentation
Frequently Asked Questions

Read the FAQ if you're having issues before sending a post on forum.

How do I install Combu on my local/live server?

Read the section Web server setup and Server and Client configuration.

How can I add my own properties to accounts?

In Combu you don't need to manually modify the core user class or database table to add your own properties to accounts like FirstName, LastName, Coins and so on.

All you need is to use user's customData: it's a Hashtable that can store every data you need. Let's see how you can extend the core user class and add a couple of custom properties as example.

First you need to create a class inheriting from User:

using System.Collections;
using Combu;
public class CombuDemoUser : User
{
string _myProperty1 = "";
int _myProperty2 = 0;
int _coins = 0;
public string myProperty1
{
get { return _myProperty1; }
set { _myProperty1 = value; customData["myProperty1"] = _myProperty1; }
}
public int myProperty2
{
get { return _myProperty2; }
set { _myProperty2 = value; customData["myProperty2"] = _myProperty2; }
}
public int coins
{
get { return _coins; }
set { _coins = value; customData["Coins"] = _coins; }
}
public CombuDemoUser()
{
myProperty1 = "";
myProperty2 = 0;
coins = 0;
}
public override void FromHashtable (Hashtable hash)
{
// Set User class properties
base.FromHashtable (hash);
// Set our own custom properties that we store in customData
if (customData.ContainsKey("myProperty1"))
_myProperty1 = customData["myProperty1"].ToString();
if (customData.ContainsKey("myProperty2"))
_myProperty2 = int.Parse(customData["myProperty2"].ToString());
if (customData.ContainsKey("Coins"))
_coins = int.Parse(customData["Coins"].ToString());
}
}
This class encodes and decodes JSON strings. Spec. details, see http://www.json.org/
Definition: Achievement.cs:7

Now we can use this new class for Authenticate and AutLogin to safely cast CombuManager.instance.loggedUser after a successful login (similar syntax can be used for other methods like User.AutoLogin or CombuManager.LoadContacts):

CombuManager.platform.Authenticate<CombuDemoUser> (username, password, (bool loginSuccess, string loginError) => {
CombuDemoUser myUser = (CombuDemoUser)CombuManager.localUser;
Debug.Log("Login: " + loginSuccess + " -- " + loginError);
if (loginSuccess)
Debug.Log("Property1: " + myUser.myProperty1);
});

I purchased it on Asset Store, can I download from your website?

Yes, you can redeem your Unity invoice (both server and addons packages) from here and you will get free access to all downloads that you purchased on Asset Store.

When I try to navigate to the web admin, I see a blank page

If you see a blank page then there's probably an internal server error and your web server is configured to hide errors from web pages, so your first step is to enable "display_errors" variable in php.ini or .htaccess (search on internet or ask to your hosting provider how to do).

Remember the requirements that your web server should meet:

  • PHP version must be 5.5 or greater
  • the zip extension module must be enabled on PHP (if it isn't enabled then the auto-updater will not be able to uncompress and install the updates, but you can still use it to automatically execute the SQL queries if required)
  • to successfully use the auto-updater feature, the server user (Apache user on OSX/Linux or IUSR/NETWORK_SERVICE on Windows) must have write permissions on Combu root folder

Also make sure you have set the correct connection settings in your /lib/config.php.