sluice
October 27, 2014, 6:28pm
1
Normally for exporting WebPlayer asset bundles we would use:
the extension .unity3d , and
the BuildTarget.WebPlayer
string[] levels = new string[] {"Assets/Level1.unity"};
BuildPipeline.BuildStreamedSceneAssetBundle( levels, "Streamed-Level1.unity3d", BuildTarget.WebPlayer);
But For WebGL, is it?
string[] levels = new string[] {"Assets/Level1.unity"};
BuildPipeline.BuildStreamedSceneAssetBundle( levels, "Streamed-Level1.unity3d", BuildTarget.WebGLPlayer);
Does the file extension still remains .unity3d ?
The extension is not important for asset bundles. You can pick whichever you like or none at all.
sluice
October 27, 2014, 7:08pm
3
Ok, so only setting the correct BuildTarget is important?
In my case, for WebGL: BuildTarget.WebGLPlayer
sluice
October 28, 2014, 1:12pm
5
Ok, so now, I am trying to load my scene. Here is the script I am using.
IEnumerator LoadSceneWebGL(string scene)
{
download = new WWW ("./AssetBundles/"+scene+".unity3d");
while(!download.isDone)
{
//here I update my preloader progress bar...
yield return null;
}
yield return download;
assetBundle = download.assetBundle;
Application.LoadLevel(scene);
yield return true;
}
Unfortunatly, it doesn’t work for me.
I get this error, in both Chrome and Firefox running on local server.
Chrome alert error:
Chrome console log:
Firefox alert error:
Firefox console log:
sluice
October 28, 2014, 2:10pm
6
Also, when trying to log the asset bundle name, after the download is finished returns nothing.
//these two alert methods returns nothing.
Application.ExternalCall("alert", download.assetBundle.name);
//and
Application.ExternalCall("alert", assetBundle.name);
Hello sluice,
you can get more details about the exception being thrown by enabling exceptions in your WebGL build.
To enable exceptions:
open Build Settings
select WebGL
click “Player Settings”
in the inspector, click “Publishing Settings”
set Enable Exceptions to a value different than none
Than recompile and run again.
Give it a try, it should give us more info to understand the problem.
RalphH
October 28, 2014, 5:05pm
8
For reference, here is what the UI looks like and what it should be set too. Make sure you make a development build.
sluice
October 28, 2014, 6:20pm
9
@GabrieleUnity , @RalphH ,
I already have my exceptions set to SoftNullReferenceExceptions.
The complete errors is:
An error occured running the Unity content on this page. See your browser’s JavaScript console for more info. The error was:
uncaught exception: abort() at jsStackTrace@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:978:13
stackTrace@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:995:22
abort@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4405672:25
nullFunc_vii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:12893:467
b82@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4401114:46
dynCall_vii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400361:7
invoke_vii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:13819:5
__ZL15CloneObjectImplP6ObjectR10vector_mapIiiNSt3__14lessIiEE13stl_allocatorINS2_4pairIiiEEL18MemLabelIdentifier90ELi16EEE [CloneObjectImpl?3(unsigned short&)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1166511:9
__Z17InstantiateObjectR6ObjectRK8Vector3fRK11QuaternionfR10vector_mapIiiNSt3__14lessIiEE13stl_allocatorINS8_4pairIiiEEL18MemLabelIdentifier90ELi16EEE [InstantiateObject?3(unsigned short&&&&)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1166857:8
dynCall_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400102:14
invoke_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:13486:12
__Z17InstantiateObjectR6ObjectRK8Vector3fRK11Quaternionf [InstantiateObject(Quaternionf?&&&)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1167007:11
__Z54Object_CUSTOM_INTERNAL_CALL_Internal_InstantiateSingleP15ScriptingObjectRK8Vector3fRK11Quaternionf [Object_CUSTOM_INTERNAL_CALL_Internal_InstantiateSingle(Quaternionf?&& )]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1785962:10
dynCall_iiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400837:14
invoke_iiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14431:12
__Z71UnityEngine_UnityEngine_Object_INTERNAL_CALL_Internal_InstantiateSingleP22mscorlib_System_ObjectP30UnityEngine_UnityEngine_ObjectP31UnityEngine_UnityEngine_Vector3P34UnityEngine_UnityEngine_Quaternion [UnityEngine_UnityEngine_Object_INTERNAL_CALL_Internal_InstantiateSingle(UnityEngine_UnityEngine_Quaternion?)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:3140116:9
dynCall_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400102:14
invoke_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:13486:12
__Z57UnityEngine_UnityEngine_Object_Internal_InstantiateSingleP22mscorlib_System_ObjectP30UnityEngine_UnityEngine_Object31UnityEngine_UnityEngine_Vector334UnityEngine_UnityEngine_Quaternion [UnityEngine_UnityEngine_Object_Internal_InstantiateSingle?1(UnityEngine_UnityEngine_Object?3?)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:3139958:8
dynCall_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400102:14
invoke_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:13486:12
__Z171UnityEngine_UnityEngine_Object_Instantiate_UnityEngine_UnityEngine_Object_UnityEngine_UnityEngine_Object_UnityEngine_UnityEngine_Vector3_UnityEngine_UnityEngine_QuaternionP22mscorlib_System_ObjectP30UnityEngine_UnityEngine_Object31UnityEngine_UnityEngine_Vector334UnityEngine_UnityEngine_Quaternion [UnityEngine_UnityEngine_Object_Instantiate_UnityEngine_UnityEngine_Object_UnityEngine_UnityEngine_Object_UnityEngine_UnityEngine_Vector3_UnityEngine_UnityEngine_Quaternion?1(UnityEngine_UnityEngine_Object?3? )]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:3139886:10
dynCall_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400102:14
invoke_iiiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:13486:12
__Z53Assembly_CSharp_TilesCoinsIntegrator_InstantiateCoinsP36Assembly_CSharp_TilesCoinsIntegrator [Assembly_CSharp_TilesCoinsIntegrator_InstantiateCoins(Assembly_CSharp_TilesCoinsIntegrator? )]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:2659944:18
dynCall_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400697:7
invoke_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14251:5
__Z46Assembly_CSharp_TilesCoinsIntegrator_InitCoinsP36Assembly_CSharp_TilesCoinsIntegrator [Assembly_CSharp_TilesCoinsIntegrator_InitCoins(Assembly_CSharp_TilesCoinsIntegrator? )]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:2659345:3
dynCall_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400697:7
invoke_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14251:5
__Z43Assembly_CSharp_TileDetectorScript_NextTileP34Assembly_CSharp_TileDetectorScript [Assembly_CSharp_TileDetectorScript_NextTile(Assembly_CSharp_TileDetectorScript? )]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:2659293:11
dynCall_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400697:7
invoke_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14251:5
__Z51Assembly_CSharp_TileDetectorScript_OnTriggerEnter2DP34Assembly_CSharp_TileDetectorScriptP34UnityEngine_UnityEngine_Collider2D [Assembly_CSharp_TileDetectorScript_OnTriggerEnter2D(UnityEngine_UnityEngine_Collider2D?**)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:2659127:10
_ZN14ActionInvoker1I17VoidPointerTraitsE6InvokeEPFvPvS2_ES2_PS2 [Invoke? ActionInvoker1<VoidPointerTraits?>?S(undefined?F? , void, void*)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:2387351:2
dynCall_iiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400837:14
invoke_iiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14431:12
__ZN6il2cpp2vm7Runtime6InvokeEP10MethodInfoPvPS4_PP12Il2CppObject [il2cpp::vm::Runtime::Invoke?4(void**, undefined?S?)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:56387:8
_il2cpp_runtime_invoke@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:28039:8
__Z20il2cpp_invoke_method21ScriptingMethodIl2CppP15ScriptingObjectP18ScriptingArgumentsPP18ScriptingExceptionb [il2cpp_invoke_method?2()]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1199713:9
__ZN19ScriptingInvocation6InvokeEPP18ScriptingExceptionb [ScriptingInvocation::Invoke(bool**)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1564207:9
__ZN19ScriptingInvocation6InvokeEPP18ScriptingException [ScriptingInvocation::Invoke(ScriptingException?**)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1564156:8
__ZN13MonoBehaviour19HandleNotificationsEPviR11MessageData [MonoBehaviour::HandleNotifications(void , int, MessageData?&)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1550647:10
__ZN16MessageForwarder13HandleMessageEPviR11MessageData [MessageForwarder::HandleMessage(void*, int, MessageData?&)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:922159:2
dynCall_viiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400312:7
invoke_viiii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:13756:5
__ZN5Unity10GameObject14SendMessageAnyERK17MessageIdentifierR11MessageData [Unity::GameObject::SendMessageAny(MessageData?&&)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:911349:4
__ZN5Unity9Component14SendMessageAnyERK17MessageIdentifierR11MessageData [Unity::Component::SendMessageAny(MessageData?&&)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:912622:2
dynCall_viii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400627:7
invoke_viii@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14161:5
__ZN19CollisionListener2D16ReportCollisionsEv [CollisionListener2D::ReportCollisions()]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1874805:10
dynCall_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400697:7
invoke_vi@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14251:5
__ZN16Physics2DManager11FixedUpdateEv [Physics2DManager::FixedUpdate()]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1878149:15
__ZZN14Physics2DState10InitializeEvEN20Physics2DFixedUpdate7ForwardEv [undefined?Z()]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1876795:2
dynCall_v@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400641:7
invoke_v@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:14179:5
__Z10PlayerLoopbbP10IHookEvent [PlayerLoop(bool, bool, IHookEvent?*)]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:1411072:14
__ZL8mainloopv [mainloop()]@file :///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:2331109:2
dynCall_v@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:4400641:7
Runtime.dynCall@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:259:14
Browser_mainLoop_runner/<@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:10796:13
Browser.mainLoop.runIter@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:5411:13
Browser_mainLoop_runner@file:///Users/this-user/Desktop/route1webgl/Data/route1webgl.js:10792:9
Then looking at that first error hint, in route1webgl.js:978:13 ,
the error is var err = new Error();
function jsStackTrace() {
var err = new Error();
if (!err.stack) {
// IE10+ special cases: It does have callstack info, but it is only populated if an Error object is thrown,
// so try that as a special-case.
try {
throw new Error(0);
} catch(e) {
err = e;
}
if (!err.stack) {
return '(no stack trace available)';
}
}
Not really of much help…
RalphH
October 28, 2014, 7:15pm
10
that stack trace doesn’t seem to imply anything related to the assetbundle loading, as far as I can see. Rather, it is happening by an instantiate call in TilesCoinsIntegrator::InstantiateCoins. However, it does look like it is an issue with either a null reference or something going wrong in the instantiate.
sluice
October 29, 2014, 12:21pm
11
With a different scene (without any TilesCoinsIntegrator stuff), It finally loads!
funny thing is the AssetBundle name returned is " ".
Now, I have to figure out why there is a problem with my other scene (most probably TilesCoinsIntegrator like you said.)
The weird thing is the scene doesn’t return any error when run alone as a build.
As with loading it as an asset, it works fine in WebPlayer, Flash and StandAlone.