- Home /
Gree integration problem
I imported the Gree SDK into my Unity (indie version) and after read the first steps in GREE Developer's Guide, I tried to make the basic script for User Authorization. But I have a problem in the code that I can't figure out how to fix:
Gree.Authorizer.Login (onLogin:( user ) => {
Debug.Log (String.Format ("C# onLogin user={0}", user.userName));
} , (string message) => {
Debug.Log ("Login error: " + message);
});
The editor's warning says that "Named arguments must appear after the positional arguments". I realize that the autocomplete options for Gree.Authorizer.Login ( does't have the onLogin option.
Heres the complete code:
using System;
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using Gree;
public class NewBehaviorScript : MonoBehaviour {
string id, userName;
private Gree.User localUser;
// Use this for initialization
void Start ()
{
Gree.Authorizer.Login (onLogin:( user ) => {
Debug.Log (String.Format ("C# onLogin user={0}", user.userName));
} , (string message) => {
Debug.Log ("Login error: " + message);
});
id = null;
userName = null;
}
// Update is called once per frame
void Update () {
}
void OnGUI ()
{
GUIStyle style = new GUIStyle ();
style.fontSize = 50;
float x = 120.0f;
float y = 120.0f;
float width = 400.0f;
float height = 100.0f;
string token = Gree.Authorizer.GetOAuthAccessToken();
if (token == null)
localUser = null;
if (localUser == null) {
localUser = Gree.Platform.GetLocalUser();
} else {
this.id = localUser.id;
this.userName = localUser.userName;
}
if (this.id != null) {
GUI.Label (new Rect (x, y, width, height), "user id = " + this.id);
}
y += height + 20.0f;
if (this.userName != null) {
GUI.Label (new Rect (x, y, width, height), "user name = " + this.userName);
}
y += height + 60.0f;
if (GUI.Button (new Rect (x, y, width, height), "Logout")) {
}
}
}
Any suggestions???
Your answer
Follow this Question
Related Questions
GREE login problem on iOS 1 Answer
Unity Gree SDK- No way to close login window!!! 3 Answers
how can use GUI.Button? framework don't recognize or suggest the method 1 Answer
Getting Unresolved Reference Warnings After Unity Update (To 5.3.4f1 64-bit) 3 Answers
Best structure for a perk system? 0 Answers