Search Unity

Importing scripts

Discussion in 'Scripting' started by April, Aug 19, 2010.

  1. April

    April

    Joined:
    Dec 14, 2009
    Posts:
    62
    Hi, i know we can't transfer files through asset bundles. However, i need to download scripts from a web server at runtime and attach them to assets at runtime, too. Is there a way to achieve this?

    Thanks.
     
  2. illogikaStudios

    illogikaStudios

    Joined:
    Nov 19, 2008
    Posts:
    66
    I haven't tried it, but the way I would do it would be to create an asset bundle with a gameObject that has the script you want attached to it. When the bundle is loaded you add the script to the object that needs it using addComponent.
     
  3. April

    April

    Joined:
    Dec 14, 2009
    Posts:
    62
    Hi, illogika. Thanks for the replya, but isn't it that scripts don't get transfered using Asset Bundles. It's just the reference that is saved.
     
  4. illogikaStudios

    illogikaStudios

    Joined:
    Nov 19, 2008
    Posts:
    66