Forum Scripting Having very basic problems....Anyone tried the DLL lately?

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

Having very basic problems....Anyone tried the DLL lately?

Postby gl33mer » September 12th, 2013, 9:30 pm

var client = PlayerIO.Connect(
etc. etc.

is giving me this error in unity -
An implicitly typed local variable declaration cannot be initialized with `void'


if I omit the var client bit I seem to be getting the success delegate triggered.

For some reason Connect is returning void, this isn't normal is it?

I need the client variable for my interactions with BigDB...
gl33mer
 
Posts: 5
Joined: September 11th, 2013, 1:37 pm

Re: Having very basic problems....Anyone tried the DLL latel

Postby Benjaminsen » September 13th, 2013, 1:38 am

Player.IO is an asynchronous API, a client is returned to you with a Callback method on a successful connect.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Having very basic problems....Anyone tried the DLL latel

Postby gl33mer » September 13th, 2013, 9:16 am

Thanks, it works.

Docs should be changed though (If I get what's going on).

Must have a delegate and is returned to this delegate.
gl33mer
 
Posts: 5
Joined: September 11th, 2013, 1:37 pm

Re: Having very basic problems....Anyone tried the DLL latel

Postby Benjaminsen » September 13th, 2013, 4:56 pm

gl33mer wrote:Thanks, it works.

Docs should be changed though (If I get what's going on).

Must have a delegate and is returned to this delegate.


That might be the case, where in our documentation would you like to see this change?
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Having very basic problems....Anyone tried the DLL latel

Postby gl33mer » September 13th, 2013, 6:16 pm

I assume it's quite prevalent in both the Unity3d and .Net code.

This bit of code, repeats itself in quite a bit of the example code and would be simple to change.


Code: Select all
//Connect to Player.IO
var client = PlayerIO.Connect(
   "[Enter your game id here]",
   "public",
   "user-id",
   null,
   null
);


It should probably include the success delegate and discard "var client".

Something like this:


Code: Select all
PlayerIO.Connect(
   "[Enter your game id here]",
   "public",
   "user-id",
   null,
   null,delegate(Client client)
            {
               Debug.Log("SUCCESS!");

            userMethod(client);
            
            }
);



I've only started out with player.io and have little experience with Async programming (still trying to figure out where the Unity3d Coroutines would be best to use.)
gl33mer
 
Posts: 5
Joined: September 11th, 2013, 1:37 pm

Re: Having very basic problems....Anyone tried the DLL latel

Postby AdamW » September 17th, 2013, 7:51 pm

Gl33mer,

Thanks for the notes regarding the documentation. We'll look into the updates needed.

Adam
Yahoo Games - Forums Moderator
User avatar
AdamW
 
Posts: 18
Joined: May 30th, 2013, 9:03 pm

Re: Having very basic problems....Anyone tried the DLL latel

Postby gl33mer » September 18th, 2013, 5:08 am

AdamW wrote:Gl33mer,

Thanks for the notes regarding the documentation. We'll look into the updates needed.

Adam



With pleasure.
gl33mer
 
Posts: 5
Joined: September 11th, 2013, 1:37 pm


Return to Scripting



cron