stream level

Toutes les questions sur le développement Mobile, y compris la partie script.
Avatar de l’utilisateur
yoyoyaya
Messages : 1656
Inscription : 30 Mai 2011 13:14
Localisation : PAAAAARTOUUUU
Contact :

Re: stream level

Message par yoyoyaya » 23 Avr 2013 16:33

namursite a écrit :bon je suppose que bon maintenant pour les balises ( voir posts précédents )
Edit tes posts précédents aussi.
ImageImage

namursite
Messages : 19
Inscription : 07 Jan 2013 11:36

Re: stream level

Message par namursite » 26 Avr 2013 10:22

bon j ai trouver ce code pas d 'erreur.
au début il ma lis
rejected because no crossdomain.xml policy file was found
je lui ai fournis en utf8 .
maintenant il me met le message suivant :
The unity3d file is not a valid asset bundle.
UnityEngine.WWW:get_assetBundle()

Code : Tout sélectionner

using UnityEngine;
using System.Collections;

public class AssetLoader : MonoBehaviour {
 
 string assetURL="http://namursite.be/1objets/AssetLoader.unity3d";
 
 // Use this for initialization
 void Start () {
  Debug.Log("Start");
  
  // This is a Unity method that hijaks the .NET co-iterator functionality and
  // uses it to create a psuedo co-routine
  StartCoroutine(LoadAsset(assetURL));
  
 }
 
 
 //This is a co-routine method. Co-routines must return the IEnumerator interface
 //This is because .NET doesnt really have co-routines, it has a co-iterator. Unity
 //cleverly hijacks that to create a co-routine. If you need more information, you
 //can try reading the micrsoft docs on yield return, but they are hairy
 IEnumerator LoadAsset(string url){
  // This call utilizes unity's asset cache to avoid reloading the same assets over again
  // If you dont want asset cahchign replace it with:
   //WWW www = new WWW(url);
  WWW www = WWW.LoadFromCacheOrDownload(url,1);
  // This is how you return from the co-routine. The www needs to be passed
  // back as a parameter. The .NET mechanism hides this within a synthetically produced
  // IEnumerator as its first entry in the enumeration but thats hidden inside of
  // StartCoroutine and you'll never see it.
  // Whatever is returned must inherit from the base class YieldInstruction
yield return www;
  //THis code is run after the www has fetched its data or errorored out
  if (www.error!=null){
   Debug.LogError(www.error); 
   Debug.Log (url);
  } else {
   Debug.Log ("Done");
   AssetBundle ab = www.assetBundle;
   Object[] tilePrefabs = ab.LoadAll(typeof(GameObject));
   foreach(Object obj in tilePrefabs){
    Debug.Log (obj.name); 
   }
  }
 }
 
svp

Répondre

Revenir vers « Développement plateformes mobile Iphone et Android »