Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Keavon · Jan 29, 2011 at 08:08 PM · apitestconnectkongregate

How do I know if my game is connecting to Kongregate's API?

Hello. I might have gotten my API to connect, but I have no idea. How do I know if I successfully connected? The game is unpublished. Thank you. -Keavon

EDIT: This is my script:

// Begin the API loading process if it is available

Application.ExternalEval(

"if(typeof(kongregateUnitySupport) != 'undefined'){" +

" kongregateUnitySupport.initAPI('MyUnityObject', 'OnKongregateAPILoaded');" +

"};"

);

var isKongregate = false;

var userId = 0;

var username = "Guest";

var gameAuthToken = "";

function OnKongregateAPILoaded(userInfoString){

// We now know we're on Kongregate

isKongregate = true;

// Split the user info up into tokens

var params = userInfoString.Split("|"[0]);

userId = parseInt(params[0]);

username = params[1];

gameAuthToken = params[2];

}

function OnGUI(){

GUI.Box(Rect(0,0,100,20), username);

}

Thank you!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Borgo · Jan 29, 2011 at 08:12 PM

You can use OnGUI function:

function OnGUI(){ GUI.Box(Rect(0,0,100,20), username);

}

there are a delay about 5 seconds, it will start showing "Guest". After connected, will show the username connected.

Edit:

For your edit: You need to rename your unity object the same name as you call in the function:

kongregateUnitySupport.initAPI('MyUnityObject', 'OnKongregateAPILoaded')

In this line, MyUnityObject is the name of the object with this script.
The ExternEval function is used in Start function;

Comment
Add comment · Show 10 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Keavon · Jan 29, 2011 at 08:20 PM 0
Share

Thank you. I edited the post to show the script I am currently using. Could you comment or give an other answer to that for use of your answer? Thank you!

avatar image Keavon · Jan 29, 2011 at 08:25 PM 0
Share

I added both of them, but it says I'm a guest on $$anonymous$$ongregate. :( I'm signed in

avatar image Borgo · Jan 29, 2011 at 08:27 PM 0
Share

I had the some problem. $$anonymous$$ake sure your object is named $$anonymous$$yUnityObject

avatar image Keavon · Jan 29, 2011 at 08:31 PM 0
Share

What do you mean by my object? The GameObject the connect + display script is attached to?

avatar image Keavon · Jan 29, 2011 at 08:33 PM 0
Share

I am going to edit the question again with my current script. Then you can add a second answer correcting it, if you don't $$anonymous$$d. It'll sure be a vote up and a best answer!

Show more comments
avatar image
0

Answer by Chris 27 · Feb 13, 2011 at 11:16 PM

@Keavon Yes, where it says 'MyUnityObject' replace that with the name in the inspector of your thing that this script is attached to. So, for example, create a Cube in scene view, attach the script to it and in the script it should read kongregateUnitySupport.initAPI('Cube', 'OnKongregateAPILoaded');

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How do I implement Kongregate's API? 0 Answers

A node in a childnode? 1 Answer

Kongregate API not connecting C# 2 Answers

How Can I submit and use statics in Kongregate API 0 Answers

Does anyone know of a Unity compatible socket server that offers true binary protocol? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges