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 - aninocoders

Pages: [1]
1
Showcase / Re: Dungelot 2 [iOS]
« on: June 25, 2014, 04:06:40 pm »
I also played Dungelot 1. Is this already available in Android?

2
Support / Re: 2.0 Migration for Atlas Generation API
« on: August 19, 2013, 09:45:24 am »
Found it:

tk2dSpriteCollection.sizeDef

Thanks!

3
Support / Re: 2.0 Migration for Atlas Generation API
« on: August 19, 2013, 09:19:07 am »
My current workaround is I set tk2dSpriteCollection.targetHeight and tk2dSpriteCollection.targetOrthoSize to public. But this is a hacky fix. Also the generated sprites no longer have the same size as it did before.

4
Support / 2.0 Migration for Atlas Generation API
« on: August 19, 2013, 08:35:29 am »
Hello,

Our atlas generator no longer works in 2.1. API changes to tk2dSpriteCollection is not specified anywhere in the Migration Guide. This is the code that no longer compiles:


        private void CreateSpriteCollection(Dictionary<string, string> idAssetsPathMap) {
         // create game object with sprite collection
         GameObject go = new GameObject(spriteCollectionName);
         tk2dSpriteCollection collection = go.AddComponent<tk2dSpriteCollection>();
         collection.version = tk2dSpriteCollection.CURRENT_VERSION;
         
         UnityEngine.Object p = PrefabUtility.CreateEmptyPrefab(spriteCollectionPath);
           GameObject collectionPrefabGo = PrefabUtility.ReplacePrefab(go, p, ReplacePrefabOptions.ConnectToPrefab);
         tk2dSpriteCollection collectionFromPrefab = collectionPrefabGo.GetComponent<tk2dSpriteCollection>();
         GameObject.DestroyImmediate(go);
         
         // prepare collection parameters
         collectionFromPrefab.textureParams = new tk2dSpriteCollectionDefinition[idAssetsPathMap.Count];
         collectionFromPrefab.targetHeight = dataManager.ScreenHeight;
         collectionFromPrefab.targetOrthoSize = 1.0f;
         collectionFromPrefab.maxTextureSize = 2048;
         collectionFromPrefab.forceSquareAtlas = true;
         collectionFromPrefab.textureCompression = this.textureCompression;
         collectionFromPrefab.allowMultipleAtlases = true;
         
         // add textures to the collection
         int i = 0;
         foreach(KeyValuePair<string, string> entry in idAssetsPathMap) {
            Texture2D texture = (Texture2D)AssetDatabase.LoadAssetAtPath(entry.Value, typeof(Texture2D));
            
            collectionFromPrefab.textureParams = new tk2dSpriteCollectionDefinition();
            collectionFromPrefab.textureParams.name = entry.Key;
            collectionFromPrefab.textureParams.colliderType = tk2dSpriteCollectionDefinition.ColliderType.ForceNone;
            collectionFromPrefab.textureParams.texture = texture;
            
            ++i;
         }
         
         tk2dSpriteCollectionBuilder.Rebuild(collectionFromPrefab);
      }


tk2dSpriteCollection.targetHeight (and some others) are no longer public and there's no property or setter that we can use. How do we fix this?

5
Support / Re: When is the combined mesh generated?
« on: June 04, 2013, 03:44:52 am »
Somehow it stopped generating the combined mesh when static is unticked.

6
Support / Re: When is the combined mesh generated?
« on: June 03, 2013, 10:04:08 am »
Found it. I unticked "Static". This feature may be useful but I think it's better if you use a different flag for it other than the built in "Static" flag.

7
Support / When is the combined mesh generated?
« on: June 03, 2013, 09:51:51 am »
We have an overlay sprite that we fade-in/fade-out whenever we change levels. This is just a simple interpolation of the alpha color and set it unto the sprite. This overlay is implemented as a non destroyable object that persists. What happens is that somehow a combined mesh ("Combined Mesh (root:scene)") is assigned to the MeshFilter of the sprite when the next level is loaded. So whatever color assigned to it no longer changes the color of the sprite.

I don't want this happening. How do I prevent it? It happens automatically.

8
Support / Re: Create Sprite Collections With Code
« on: April 24, 2013, 11:09:43 am »
Thanks. Will try that.

9
Support / Re: Create Sprite Collections With Code
« on: April 24, 2013, 10:10:49 am »
I've done it. This is the minimal code. I had to make HandleDroppedPayload() public, though, which is a hack. Maybe you have a more elegant way of doing this.

    private void CreateSpriteCollection() {
      // create game object with sprite collection
      GameObject go = new GameObject("TestSpriteCollection");
      tk2dSpriteCollection collection = go.AddComponent<tk2dSpriteCollection>();
      collection.version = tk2dSpriteCollection.CURRENT_VERSION;
      tk2dEditorUtility.SetGameObjectActive(go, false);
      
      string path = "Assets/HomageData/TestSpriteCollection.prefab";
      Object p = PrefabUtility.CreateEmptyPrefab(path);
        GameObject collectionPrefabGo = PrefabUtility.ReplacePrefab(go, p, ReplacePrefabOptions.ConnectToPrefab);
      tk2dSpriteCollection collectionFromPrefab = collectionPrefabGo.GetComponent<tk2dSpriteCollection>();
      GameObject.DestroyImmediate(go);
      
      tk2dSpriteCollectionEditorPopup editor = EditorWindow.GetWindow(typeof(tk2dSpriteCollectionEditorPopup), false, "SpriteCollection" ) as tk2dSpriteCollectionEditorPopup;
      editor.SetGenerator(collectionFromPrefab);
      
      // load textures
      Texture2D texture1 = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Game/Textures/leg_cut1.png", typeof(Texture2D));
      Texture2D texture2 = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Game/Textures/leg_cut2.png", typeof(Texture2D));
      Object[] payload = new Object[]{ texture1, texture2 };
      
      // simulate drag and drop to editor
      editor.HandleDroppedPayload(payload);
      editor.Commit(); // create the sprite collection
      
      editor.Close();
   }

10
Support / Create Sprite Collections With Code
« on: April 24, 2013, 07:54:15 am »
Hello Unikron,

I'm building a Unity parser for another game engine. The game engine spouts XML files that we can read. Basically, the whole game can be constructed from these files.

I'm working on a Unity editor for this. The editor will ask for the folder of the XML files, parse these, copy image files, and create game objects on click of a button. Right now, I'm stuck on how to create Sprite Collections with code. Is this possible? I've rummaged through the 2D Toolkit source code. I can see how it goes from Open Editor... I just can't get the code flow when doing it without the editor.

Pages: [1]