• 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 /
This question was closed Dec 19, 2013 at 09:51 AM by Bunny83 for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by klipnov · Dec 18, 2013 at 07:24 PM · wwwscoreleaderboardurladdress

Unity3D WWW takes URL from address bar

I am using the WWW class and using it to get score from getScore.php.. It works but when i built it and run on the web player it won't work.

I checked using"Inspect Element" and actually it called http://company.com/game/company.com/game/getScore.php when I need it to call http://company.com/game/getScore.php

The address from the address bar is added in front of the url that I wanted to call.Does anybody know the reason for this to happen? This is the code I'm using.

 using UnityEngine;
 using System.Collections;
 
 public class score : MonoBehaviour {
 
     public GUIText scoreText;
     string theURLis = "http://company.com/game/getScore.php";
 
     // Use this for initialization
     void Start () {
         StartCoroutine ("getScore");
     }
 
     void OnGUI () {
         if (GUI.Button (new Rect (600, 400, 50, 30), "back"))
                         back ();
     }
 
     void back() {
         Application.LoadLevel ("menu");
     }
 
     IEnumerator getScore() {
 
         WWW getScoreText = new WWW (theURLis);
 
         yield return getScoreText;
 
         scoreText.text = getScoreText.text;
 
     }
 }
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

1 Reply

  • Sort: 
avatar image
0

Answer by Bunny83 · Dec 18, 2013 at 07:26 PM

Since your code contains a dummy address, are you sure your URL starts with "http://"? Also are you sure you don't do any strange changes at runtime? Try printing the URL right before the WWW call and check the logfile

Comment
Add comment · Show 1 · 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 klipnov · Dec 19, 2013 at 02:34 AM 0
Share

wtf, suddenly it works.. i don't know what was the problem. hmmm.. thanks for replying

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sending logs over the Internet 1 Answer

Doesn't WWW like HTTP 302 (Redirect)? 2 Answers

WWW not getting site that doesn't end on .html 1 Answer

Server Based High Score - issues with adding new score 1 Answer

ExternalEval and Url Error 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