Forum Scripting cant connect unity to player.io

Post your problems and discussions relating to scripting in Unity here.

cant connect unity to player.io

Postby MahamedDam123 » May 22nd, 2017, 7:50 pm

cant connect unity using documentation language c# it gives me error i hope someone help me iam creating an android game
and its not working hope someone give me a simple script to connect unity game to my player.io game
MahamedDam123
 
Posts: 3
Joined: February 12th, 2016, 1:13 am

Re: cant connect unity to player.io

Postby Henrik » May 23rd, 2017, 4:39 am

What error messages are you getting?
Henrik
.IO
 
Posts: 1822
Joined: January 4th, 2010, 1:53 pm

Re: cant connect unity to player.io

Postby MahamedDam123 » May 23rd, 2017, 3:57 pm

the script is
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PlayerIOClient;

public class server : MonoBehaviour {


    // Setup the Player.IO Client in Unity3D
// "this" is a reference to a MonoBehavior. You could put this
// code in the "Start()" method of a MonoBehaivor
PlayerIOClient.PlayerIO.UnityInit(this);
 
//Connect to Player.IO
var client = PlayerIO.Connect(
    "[Enter your game id here]",
    "public",
    "user-id",
    null,
    null
);
}


and the error is

Assets/server.cs(12,34): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
MahamedDam123
 
Posts: 3
Joined: February 12th, 2016, 1:13 am

Re: cant connect unity to player.io

Postby Henrik » May 23rd, 2017, 11:17 pm

That's a compilation error because that is not valid C# code. You've just pasted the example code into the middle of the body of some class.

I suggest you look up some tutorials on Unity3D that shows you appropriate methods you can add or override on MonoBehaviour to have it do things, either when the game starts up or after some user interaction.
Henrik
.IO
 
Posts: 1822
Joined: January 4th, 2010, 1:53 pm


Return to Scripting



cron