Game Development Reference
In-Depth Information
Unity Hands On
Integrating OpenFeint with Your Unity Game
Step 1. Create a login at the OpenFeint developer site as discussed
in the previous section ( https://api.openfeint.com/dd ).
Step 2. Login and Add a New Game. Give your game a name and
select the Android development platform. Click on save.
Step 3. Select Application Information. Record the Client Application
ID, Product Key, and Product Secret.
Step 4. Create a new Unity Android Project.
Step 5. Download Chapter Eight/OpenFeint-UnityAndroid
.package .
Step 6. Import the package into your project.
Step 7. Download Chapter Eight/OpenFeintController.cs and add into
the Project > Plugins folder.
Step 8. Select GameObject > Create Empty from the main menu.
A new game object will be added to the Hierarchy. Rename it
OFObject .
Step 9. Drag and drop the OpenFeintController script from Project >
Plugins onto the OFObject.
Step 10. Create a new JavaScript file in the root of the Project called
OFInterface. Add the code shown in Listing 8.17 .
Listing 8.17 Initializing OpenFeint
var OF;
function Start()
{
OFObject = GameObject.Find("OFObject");
if(!OFObject) //if not found one must be added
{
print("Create an OFObject before proceeding");
}
else
{
OF = (OFObject.GetComponent
("OpenFeintController") as
OpenFeintController);
}
}
function OnGUI()
{
if (GUI.Button(new Rect(10,10,300,80), "Initialize
OpenFeint"))
{
Search Nedrilad ::




Custom Search