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?