I am using Paper2D sprites to render platforms in my game. It works perfectly fine when playing in the editor, but as soon as I use the Launch button or package the game and test it, certain sprites start rendering weirdly.
The sprites are using the default MaskedUnlitSpriteMaterial and it only happens for some of them. This happens for both orthographic and perspective cameras. All rendering settings and sprite/texture properties are left on their defaults.
Mobile preview is typically a very good indicator of how a project will render on the device, is that how you’re playing it in the editor? Sometimes rendering issues such as these are a result of unsupported/unrecommended assets being used for mobile development. Have you double-checked the guidelines for Mobile Development documentation to ensure that you’re not including anything that might cause such an issue (the asset you mentioned that is broken, perhaps)?
If you can, include your build’s output logs to this thread as a txt file and I can have a look and see if anything appears to be unsupported.
I think I’ve isolated what the issue is and I’m afraid that I don’t have a good workaround without a source modification. It is a race condition between texture and sprite loading during cooking, as the ConditionalPostLoad call doesn’t block for the texture when running the cooker as a separate commandlet like it does when run from the editor. This means that the bug shouldn’t show up when you use Launch On, which defaults to cook-in-editor, but will show up when packaged via Package or UFE.
I’ve filed a ticket UE-14171 and I’ll get that fixed for 4.8. The full fix will be to get size via a different mechanism, but as a quick hack you can try skipping the resizing code by changing UPaperSprite::NeedRescaleSpriteData() to always return false.