- Home /
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!
Answer by Faskoona · Nov 07, 2010 at 04:46 PM
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.
Answer by JDonavan 1 · Oct 30, 2010 at 05:09 AM
I think what you're looking for is an asset bundle. http://unity3d.com/support/resources/example-projects/assetbundles.html
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.
Your answer
Follow this Question
Related Questions
Having Trouble with Javascript GET and URL 1 Answer
Failed downloading http with WWW on Internet Explorer 0 Answers
Bytes array always empty in WWW object (on WebPlayer) 0 Answers
WebPlayer and WWW, stalls forever on get.... 0 Answers
How do I properly send binary data (byte[]) to a MySQL database? 4 Answers