- Home /
how to build a 2d character which can faced 2 directions(left and right), with high performance
I made a character, as a prefab, faced left side.
When I need a character face right side, I made a "scale.x *= -1" on it's transform component, known as "flip".
It looks ok in editor, I placed 6 character in one scene, 3 faced left, 3 faced right, frame rate is about 160(drop down from 200).
but when I run it on my mobile phone(samsung 9082, 2 cpu cores), the frame rate drop down to 15(from 60).
I delete 3 characters faced left(or 3 characters faced right), frame rate become 60. That means if there was only 2 characters which has opposite direction, the frame rate down to 15.
I tried place 20 characters with the same direction in one scene, frame rate is 50(only cost 10 frames). so I can say, the flip caused this problem.
But how to solve it? how do you guys make characters faced two directions?
Answer by Ashutosh8126 · Feb 26, 2014 at 12:49 PM
I don't think that the actual reason the drop of framerate is character scaling in any terms.. It can be due to the rig structure of the character and also do check your character textures sizes for Mobile Devices// Other way of fliping your character is to use a type a shader for the character which displays both ways.. It depends on the shader you are using.. And them you can simply rotate the character on the Y Axis
"rotate the character on the Y Axis" solve this problem perfectly.
framerate in battle scene is also 60 now.
thanks a lot...Ashutosh8126. But this is also proved that the reason of the drop of framerate is character scaling, isn't it?
NO character scaling is never a problem.. I think you should check the texture compression settings.. click on the texture of the character and check its compression settings on the inspector.. If you found solution in my above answer then please click on the answered button on the left.. :) thanks..
filter mode: bilinear format: compressed max size: 1024
is it ok?