- Home /
Problem Loading Asset Bundles on Web Player
Hi people,
I'm working on a project that involves using the Island demo with the Character Customization project running on the SmartFoxServer 2X. The thing is, using Unity 2.x I didn't have any problem loading the assets of Character Customization in both the editor and the web player. However, recently I updated to Unity 3.1 and I'm having problems to load the same scene (CharacterCustomization's room). It seems the asset bundles do not load at all when using the web player, but they do when using the editor. This is the piece of code that handles where to look for the assetbundles folder:
// Returns correct assetbundle base url, whether in the editor, standalone or
// webplayer, on Mac or Windows.
public static string AssetbundleBaseURL
{
get
{
if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
return Application.dataPath+"/assetbundles/";
else
return "file://" + Application.dataPath + "/../assetbundles/";
}
}
I'm placing the assetbundles folder in the same folder as "Assets" and the Webplayer.html file (with its unity3d file) in the same folder as the previous two. So, my question: how come it did work in Unity 2.x but it doesn't in Unity 3.1? Do I have to take something else into account when using the webplayer instead of the editor?
Thanks in advance for your time!
Answer by JoseFranco · Dec 22, 2010 at 12:29 PM
Finally I managed to solve the problem. The bug wasn't on the code itself but in the assetbundles I was using which were the ones from the 2.x version. Update the assetbundles and the database made it work.
I have the same problem, but it's not linked with versions of Unity. Is it so important to use the Application.platform? Why couldn't I use a direct path like this -
var www = new WWW("file://" + Application.dataPath + "/myBundle.unity3d")?
Thanks!
EDIT:
$$anonymous$$y problem is solved. Here is the solution