Search Unity

Assetbundle contain xml, load and read xml!

Discussion in 'Scripting' started by leominor, Sep 6, 2011.

  1. leominor

    leominor

    Joined:
    Aug 29, 2011
    Posts:
    5
    Hi!

    I creat an assetbundle witch contain a "file.xml", after build my assetbundle i send th unity3d on a server "www.aaaa.com/file.unity3d".
    I load the asset bundle with www dowmload = WWW.LoadFromCacheOrDownload("stringname", fileversion).
    But how get the xml contain in the asset bundle, I try this :

    assetBundle = download.assetBundle;
    //assetBundle is not null I use debuglog for test

    UnityEngine.Object XML = assetBundle.Load("file.xml", typeof(UnityEngine.Object));
    // XML == null, i try assets/file.xml and XML == null too.

    XmlReader reader = XmlReader.Create("file.xml");

    thx for your help.

    fabien
     
    Last edited: Sep 6, 2011
  2. bdev

    bdev

    Joined:
    Jan 4, 2011
    Posts:
    656
    i think you want to do:

    assetBundle.Load("file", typeof(UnityEngine.TextAsset));

    Mainly i don't think you specify the extension.
    Then you use the TextAsset .text or .bytes to read from.