how do I get my friendlist custom data ? I spent the whole day trying to find out
so far this is what I have
Combu.CombuManager.localUser.LoadFriends(Combu.eContactType.Friend, (bool success) => {
if (Combu.CombuManager.localUser.friends.Length == 0)
{
}
else
{
for (int i = 0; i < Combu.CombuManager.localUser.friends.Length; ++i)
{
testing = Combu.CombuManager.localUser.friends[i].userName;
//this is what I want get my friends lvl
testing = Combu.CombuManager.localUser.friends[i].customData["currentlvl"];
}
}
});
You need to cast Combu.CombuManager.localUser.friends[i] to User, then you can access its customData:
Combu.CombuManager.localUser.LoadFriends(Combu.eContactType.Friend, (bool success) => { if (Combu.CombuManager.localUser.friends.Length == 0) { Debug.Log("No friends"); } else { for (int i = 0; i < Combu.CombuManager.localUser.friends.Length; ++i) { var user = (User)Combu.CombuManager.localUser.friends[i]; var testing = user.userName + " level: " + user.customData["currentlvl"]; Debug.Log(testing); } } });
It's working this way because Unity's ILocalUser interface requires "friends" to be a IUserProfile object, so we worked around it.
FRANCESCO CROCETTI @ SKARED CREATIONS
thank you also how do you check if image is stored in database
userdata.image = combuFaceImage;
I also tried to store in custom data but was unable to and I tried calling it but it showed nothing it looks like I'm storing it correctly but when I try to retrieve it it won't show
Combu.CombuManager.localUser.LoadFriends(Combu.eContactType.Friend, (bool success) => { if (Combu.CombuManager.localUser.friends.Length == 0) { Debug.Log("No friends"); } else { for (int i = 0; i < Combu.CombuManager.localUser.friends.Length; ++i) { var user = (User)Combu.CombuManager.localUser.friends[i]; var testing = user.userName + " level: " + user.customData["currentlvl"]; face[i] = user.image } } }); also how do I combine Facebook game request with combu message like give a person a life. I tried using https://developers.facebook.com/docs/sharing/opengraph/object-api but I don't see the option to create new object
To store a file (like image or anything else) associated to a user you would use a UserFile and could use the property "name" to define what's the file, here is the documentation.
About your other question I'm not an expert Facebook developer and only used authentication and share posts, so I cannot help you with it (if you need custom messages between friends you could for example give a predefined subject to the message and then assign a JSON string to the content, which you will deserialize later if you need to store more "properties" to a message).
FRANCESCO CROCETTI @ SKARED CREATIONS
I was able to successfully upload it to file but how do I retrieve it I tried
Texture2D obj;
var file = (Combu.UserFile)Combu.CombuManager.localUser.friends[i];
file.Download((obj));
Check the documentation link I sent above, it contains the section that explains how to load the files of a user (UserFile.Load).
Download method accepts a callback that will have a byte array that is the file content, you can use the byte array to create a Texture2D:
file.Download ((byte[] content) => { if (content != null && content.Length > 0) { Texture2D tex = new Texture2D(2, 2); tex.LoadImage(content); } });
FRANCESCO CROCETTI @ SKARED CREATIONS