Results 1 to 2 of 2

Thread: Can't spawn asset bundle

  1. #1

    [SOLVED] Can't spawn asset bundle

    This should be simple. What am I doing wrong? Instead of the asset bundle loading, I get the dialog box to import an asset bundle. Actually, there are two empty dialogs, one below the other. If I then enter the same URL in the dialog as in the script, the object loads.

    The callback function is called, but the object it receives is a function (e.g, the output is "confetti_callback function: 000066AA"), so something is wrong here.

    function confetti()
        spawnParams = {
            type = 'Custom_Assetbundle',
            position          = {x=0, y=2, z=0},
            assetBundle = '',
            material = 1,
            callback_function = function(obj) confetti_callback(obj) end
    function confetti_callback(obj)
        confetti_obj = obj
        print('confetti_callback ', confetti_obj.getName)
    Last edited by MikeBlyth; 08-26-2019 at 11:42 PM.

  2. #2
    It took a long time, but I figured this out. I think there should be an example in the documentation for how to spawn an asset bundle, because as far as I could tell, the instructions aren't correct or else aren't clear. Anyway, all of you using asset bundles must have already figured this out, and it's fairly simple, but here is the model I finally used:

    function spawn_confetti()
        spawnParams = {
            type = 'Custom_Assetbundle',
            position          = {x=-7, y=4, z=-5},
            scale             = {x=1, y=0.01, z=1},
        spawned = spawnObject(spawnParams)
        spawned.setCustomObject({assetbundle = ''})
    My main two errors were

    1. putting the assetbundle definition into the spawnParameters; evidently it's not used until after the object is created
    2. later, using a callback function to set the assetbundle instead of just doing it immediately after the spawnObject. Documentation says that callbacks are needed since it takes some time for the object to be spawned, but maybe that's no longer true. I'm guessing that when I had it in the callback, the program "noticed" the missing URL immediately after the object was spawned, so popped up the dialog to ask for the URL. Sort of a race condition?

Similar Threads

  1. Asset Bundle will not load
    By Volg in forum General Discussion
    Replies: 0
    Last Post: 01-27-2019, 04:46 AM
  2. Asset Bundle collision problems
    By dhdyer in forum General Discussion
    Replies: 1
    Last Post: 01-12-2018, 12:32 AM
  3. Asset bundle shader options?
    By FoaS in forum General Discussion
    Replies: 1
    Last Post: 05-13-2017, 11:18 AM
  4. Asset Bundle Animation
    By RiceKun in forum General Discussion
    Replies: 8
    Last Post: 02-01-2017, 01:24 AM
  5. Asset Bundle Animation
    By MrStump in forum General Discussion
    Replies: 11
    Last Post: 12-30-2016, 11:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts