16
Support / Re: tk2dSprites render pink when changing scene / using LoadScene
« on: February 05, 2016, 05:54:18 pm »
Holy sh*t, I found it (actually a colleague pointed me in the right direction)! The problem lies within Unity 5.3. Apparently, every call to the material properties of a tk2dSprite within the first frame of the Start() breaks about everything. If I skip the first frame in the Start(), everything work perfectly!
So if I do this hack, it works!
A second thing to keep track of is that these issues DON'T affect any -builds- that were made with 5.3. So the sprites in my build for iOS are all there (and not pink), even though the same build turns everything pink in the editor / playmode.
I did some other tests on the default Unity prefabs (sprites, cubes, etc), but it doesn't seem to affect those. I guess that this bug has something to do with Unity 5.3 in combination with tk2d? Something has changed in 5.3 that affects the allocation of the materials within the tk2d framework (in 5.2.4 everything works without hassle).
So yeah, I'm rambling. If anyone needs more info, let me know. For now I revert back to 5.2.4 (I don't feel like changing all my Start voids into IEnumerators). Hopefully unikron can come up with a fix, that would be awesome (or we can wait for the next update of Unity 5.3 and see what happens then).
So if I do this hack, it works!
Code: [Select]
// this works
private IEnumerator Start(){
yield return new WaitForSeconds(0);
Material m = settingsBackgroundButton.GetComponent<Renderer> ().materials [0];
Debug.Log(m[0].name);
}
// this generates pink sprites
private void Start(){
Material m = settingsBackgroundButton.GetComponent<Renderer> ().materials [0];
Debug.Log(m[0].name);
}
A second thing to keep track of is that these issues DON'T affect any -builds- that were made with 5.3. So the sprites in my build for iOS are all there (and not pink), even though the same build turns everything pink in the editor / playmode.
I did some other tests on the default Unity prefabs (sprites, cubes, etc), but it doesn't seem to affect those. I guess that this bug has something to do with Unity 5.3 in combination with tk2d? Something has changed in 5.3 that affects the allocation of the materials within the tk2d framework (in 5.2.4 everything works without hassle).
So yeah, I'm rambling. If anyone needs more info, let me know. For now I revert back to 5.2.4 (I don't feel like changing all my Start voids into IEnumerators). Hopefully unikron can come up with a fix, that would be awesome (or we can wait for the next update of Unity 5.3 and see what happens then).