x


How To Use LoadUnityWeb To Load a New Webplayer

Hello,

I am using a webplayer interface to load a game on my server when a button is clicked. Everything seems to be going well (no errors), but the new webplayer game never loads/starts. Am I missing something in the code below? Or is it due to the webplayer I am trying to load (ie: does it need to be a streamed webplayer etc)?

    using UnityEngine;
    using System.Collections;

public class InterfacerB : MonoBehaviour {

void OnGUI()

{ 
   if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 10, 100, 25), "Load Game 1"))
   {

      StartCoroutine("StartLoad");

      Debug.Log("Clicked to load");
   } 

}

    IEnumerator StartLoad () {

        WWW stream = 
          new WWW ("http://www.faskoona.com/mature/m_content/content01/WebPlayer/WebPlayer.unity3d");
        while (!stream.isDone) {
        Debug.Log("Loading");

            yield return null;
        }

        stream.LoadUnityWeb();
    }
}

Any help is greatly appreciated!

more ▼

asked Oct 28 '10 at 10:10 PM

Faskoona gravatar image

Faskoona
111 3 4 12

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

I have found the answer to my problem. There is nothing incorrect in the code.

I had to read this documentation: http://unity3d.com/support/documentation/Manual/Security%20Sandbox.html All I needed to include was the crossdomain.xml document in my server root directory, and all works well.

I would have figured this out a long time ago, but when I initially looked into the "no crossdomain.xml policy exists" error, someone said to simply ignore it as it was not important.

more ▼

answered Nov 07 '10 at 04:46 PM

Faskoona gravatar image

Faskoona
111 3 4 12

(comments are locked)
10|3000 characters needed characters left

I think what you're looking for is an asset bundle. http://unity3d.com/support/resources/example-projects/assetbundles.html

more ▼

answered Oct 30 '10 at 05:09 AM

JDonavan 1 gravatar image

JDonavan 1
462 2 6 18

Hi, I'm actually looking to load an entirely new game. Basically I am making a menu where you choose from a list of games. You make a selection and it will load/stream that entire game. From what I understand Assetbundles do not include scripts as assets so I don't think I can use that method.

Oct 30 '10 at 08:41 AM Faskoona
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x815
x527
x39

asked: Oct 28 '10 at 10:10 PM

Seen: 1445 times

Last Updated: Nov 03 '10 at 02:13 AM