Hello, I am trying to generate an atlas at runtime, and in NGUI <2.7.0, I used the following code:
UIAtlas atlas = gameObject.AddComponent("UIAtlas") as UIAtlas;
yield return StartCoroutine(Assets.DownloadAssetBundle(url, version));
AssetBundle bundle = Assets.GetAssetBundle(url, version);
AssetBundleRequest pngRequest
= bundle
.LoadAsync(key,
typeof(Texture2D
)); AssetBundleRequest txtRequest
= bundle
.LoadAsync(key,
typeof(TextAsset
)); yield return pngRequest.isDone && txtRequest.isDone;
Material mat
= new Material
(Shader
.Find("Unlit/Transparent Colored")); mat.mainTexture = pngRequest.asset as Texture2D;
atlas.spriteMaterial = mat;
atlas.coordinates = UIAtlas.Coordinates.Pixels;
atlas.pixelSize = 0.5f;
NGUIJson.LoadSpriteData(atlas, txtRequest.asset as TextAsset);
However, in NGUI 3, I get a Unity error that states that UIAtlas.Coordinates is protected, and atlas.coordinates does not exist. Can I just delete that line, or do I need to substitute it with another line? Also, are there any other changes that need to be made to update the above function?