2D Toolkit Forum
2D Toolkit => Support => Topic started by: xtr33me on February 22, 2012, 04:42:25 am
-
I have a game similar to bejeweled that I am working on. I originally had it in 3D, but have recently converted over to 2D. I have a bunch of cubes that make up the board and each cube has an idle state image (Single), infected state (animated sprite) and a dead state (single image again). When my cubes are destroyed I call the below code. When I was doing this in 3D before, I would just change the material on the renderer and it went very quickly. Now it seems since I have changed over to 2D, I am getting a huge performance hit when calling the function below.
When I comment out the "anim.Play" line, the performance hit disappears. What is the best way to change back to my idle image across all blocks destroyed. I am not allocating any memory. When I destroy an object, I simply scale the object down, call the method below and then scale it back up. I also keep track of the id's so I dont have to have 2DToolkit perform a lookup by the string, but that didnt seem to increase performance much. Guess my overall question is what is the proper way to do this without taking a hit. Whats happeneing is when I am destroying like 8 cubes at once, it just sits there for literally a couple noticable seconds before continuing. One last thing I have recently upgraded to 3.5 and not sure if there are any known issues right now with 2dtoolkit and the new version. I can't say if this was happening in the older version since I have recently changed over to 2D. Any ideas?
void SetRandomcolor()
{
ColorIndex = _boardMgr.GetWeightedRandomColor();
anim.Play(_boardMgr.MyBlockColors[ColorIndex].IdleAnimationIndex);
_boardMgr.MyBlockColors[ColorIndex].NumOnBoard++;
_boardMgr.PopulateProbabilities();
}
-
Hi,
What version of 2D Toolkit are you using? I've had much much more than that working properly on iOS. Playing 8 animations shouldn't slow anything down at all - perhaps there is a bug in the version you are using.
The next thing to see is if it is possible to send me a test case to look at and sort out for you (use support at unikron software) if at all possible, otherwise I will send you more troubleshooting steps to run through to narrow down the problem.
-
Thanks Unikron! I am using the latest, but I did go to verify this morning to make sure and I couldn't update any higher. If I remememebr it was 1.35. Even though I bought this when I got Unity, I just downloaded it to use it this week when I was going through the 2D conversion. I am currently at work, but when I get home tongiht I will try to put togehter a very basic project that I should be able to replcate what I am doing. I will then send that off to you. Thanks for your help and I will talk to you later!
-
Well I was putting together the mini project with basic functionality of what I thought was best representing what the issue was and it seems to be having no issues flipping. It is actually working perfectly. I guess I need to dig into this further. I may be contacting you again, but as of now I have to look into this a bit deeper. Thanks for your reply and help!!
-
Cool. Let me know if it becomes an issue.