Open davyzhang opened 1 year ago
something wrong with my picture indeed, sorry for the issue
Hi! I'm glad you solved the issue. 0.5 is the default origin in images and sprites, for that reason the editor doesn't generate code for it.
Thank you so much for your excellent work! I think its better to post the finding here in case someone meets the same problem.
The reason is the tool texturepacker gui set the origin as 0,0 by default for every frame inside the json file. PhaserEditor2d does a very good job to respect this value and render it correctly in the first place.
And the problem is, if I set it back to 0.5,0.5 in the editor, No code will be generated to correct this value, so in the phaser side, it would still be 0,0 as the texture packer indicates.
The easy way to fix is just toggle off the option of texture packer to let phaser decide the origin.
Oh! I see. Yes, because in that case, 0.5 is not the default value in Phaser, but it is in the editor. It could be a bit complicated to handle these cases. Maybe I should provide the option of forcing the editor always to generate the origin for certain objects. I'm re-opening the issue.
Thanks for the kind words!
Version
Description
Changing a image object's origin inside the prefab doesn't generate corresponding code, it looks being ignored. But it can display correctly in the editor. This only happens when set the origin to 0.5, if it is set to other values , code will be generated correctly
Possible solution
manually add the code
code generated like this: