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

Pages: [1]
1
Support / Re: How can I change the tk2dSprite's "Texture" in runtime?
« on: August 09, 2013, 02:59:42 am »
Thanks~

2
Support / Re: How can I change the tk2dSprite's "Texture" in runtime?
« on: August 08, 2013, 10:12:02 am »
What are you trying to do here? Is there any reason you're not putting the asset bundle into the atlas itself?

Thanks your reply.

putting the asset bundle into the atlas itself?

I want to pack the atlas into a asset bundle;
download it from httpServer when the client at runtime, and re-link it with tk2dSprite , it's tk2dSpriteCollectionData,
(Sprite and SpriteCollectionData has been created in unityEditor not at runtime)

3
Support / How can I change the tk2dSprite's "Texture" in runtime?
« on: August 08, 2013, 04:52:49 am »
tk2dSprite and it's tk2dSpriteCollectionData is builded in Unity's Editor,
Only need re-link the texture at runtime.
Because need pack the texture in assetBundle, and download at runtime;
this is my test code,
but get a err message :

"UnassignedReferenceException: The variable material of 'tk2dSpriteCollectionData' has not been assigned.
You probably need to assign the material variable of the tk2dSpriteCollectionData script in the inspector."

Code: [Select]
        GameObject nol = GameObject.Find( "normal" );
        tk2dSprite script = (tk2dSprite)nol.GetComponent( "tk2dSprite" );
        tk2dSpriteCollectionData col = script.Collection;
        Material mat = col.material;
        mat.SetTexture( "txt", loadTex );
        //Texture tex = mat.mainTexture;
        //tex = loadTex;

Pages: [1]