What I see in the editor is not what I see in the game

Hello,

I find it a little bit frustrating when I do a setup in the editor view (editing a collection) and then I see something different in the game.

For example, if I want to flip a sprite, I can do it in different ways:

  • Setting a the scale.x to a negative value
  • Rotating the y and z angles to 180 degrees

Any of the two looks ok in the editor, but only the last one is correct when I run the game. See the attached screenshots.

Editor:

Ingame:
defold_ingame

Is there a reason behind this? Or it is a bug that would need to be fixed?
Thanks.

1 Like

I think that the editor and the runtime might not handle negative scale in the same way. Perhaps @mats.gisselson or @Erik_Angelin could fill in?

Perhaps you can use rotation instead of negative scale to work around the issue in the meantime.

1 Like

One thing to note also is that negative scale won’t work with physics objects (in case you were planning on adding such to your game object)

3 Likes

Negative scale is not really supported at the moment. There is currently an issue when building from the editor that assumes positive scale factors, but even if we address that you’ll run into other issues like the one Mathias mentioned. Negative scale factors can also reverse the triangle winding order and invert vertex normals, so your shaders and render script would need to take that into account.

If you can achieve the same effect by rotating your object, that is the recommended approach.

2 Likes

I understand the problems having a negative scale factors could bring.

What I don’t understand is why is it still allowed to set it from the editor then? And even more annoying, why does the editor show a behaviour that is different from what the game will be showing when run?

Thanks for your answers :slight_smile:

3 Likes