Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - KarlBuiter

Pages: [1]
1
Support / Re: tk2dSpriteAnimation and AssetBundles. Clarifications needed.
« on: September 12, 2013, 10:49:30 pm »
I got it running.  It was a flub in my instantiation reference...  component grab from the prefab, not the instantiated object.

Thanks,  Good exercise.

2
Support / tk2dSpriteAnimation and AssetBundles. Clarifications needed.
« on: September 12, 2013, 03:44:35 am »
Hello,

  I have a project that successfully uses TK2D for several sets of Sprite Animations.  I now need to expand the project to several flavors and will load assets using AssetBundles and instantiate the loaded prefabs.

  I exported all the art, sprite, animation, and prefab objects into an empty project.  This was related to a thread discussing asset isolation.  TK2D was imported.  I have been experimenting with both forms of ExportAssetBundles... one method involves creating separate bundles for Sprites, Animations, then Prefabs without dependencies; the other involves packing the bundle at the Prefab level with dependencies.

  In the main program, I have been loading each of the asset bundles (in order) with LoadAll() for Sprites and Animations; then explicit load and instantiation for each of the prefabs.

  The Sprites seem to work - though they seem to be misbehaving someone on being active or not active.  But with Animations - I get the first frame of the animation - the properties/watch suggest all frames are referenced, its playing, has fps, it is not paused, etc.  But nothing plays.

  I have seen references to including SpriteCollectionData data component in the bundle.  I followed a reference a Demo Sprite Collection and copying the data part to my assetbundle but its only 6k, not 28k as suggested.  This whole part is a bit confusing.

  So here is a bit of code on how I am trying to load this (in a non-dependency way)

   void LoadSpritesBundle ()
   {   
      var assetPath = "file://" + Application.dataPath + "/Bundles/MySceneSprites.unity3d";
      
      // Open the Asset
      WWW www = WWW.LoadFromCacheOrDownload (assetPath, 1);
      
      // Get the Asset Bundle
      AssetBundle bundle = www.assetBundle;
      
      // Load all the assets
      bundle.LoadAll ();
   }   
   
   void LoadAnimsBundle()
   {   
      var assetPath = "file://" + Application.dataPath + "/Bundles/MySceneAnims.unity3d";
      
      // Open the Asset
      WWW www = WWW.LoadFromCacheOrDownload (assetPath, 1);
      
      // Get the Asset Bundle
      AssetBundle bundle = www.assetBundle;
      
      // Load all the assets
      bundle.LoadAll ();
   }
   
   void LoadPrefabBundle()
   {
      GameObject myObject;

      var assetPath = "file://" + Application.dataPath + "/Bundles/MyScenePrefabs.unity3d";
      
      // Open the Asset
      WWW www = WWW.LoadFromCacheOrDownload (assetPath, 1);
      
      // Get the Asset Bundle
      AssetBundle bundle = www.assetBundle;
      
      // Load
      myObject = bundle.Load ( "MyObject", typeof(GameObject)) as GameObject;
      Instantiate (myObject);
      //Instantiate (myObject, new Vector3(87.0f,81.0f,-5.1f),Quaternion.identity);
      myObjectAnimatedSpriteArray[0] = myObject.GetComponent<tk2dAnimatedSprite>();
....
}

I obviously gone on a tangent.  But the info I have digested so far seems to have confused me a bit... particularly the SpriteCollection Data part.

Help me find my way back :)

Pages: [1]