Sprite.Create created sprite during editor time becomes null during runtime
I have a sprite created with Sprite.Create during editor time for tool to pre-bakes some masks I need. When I press a button, it calculates some texture math, then creates a sprite with Sprite.Create. A new gameObject is created with a SpriteRenderer component and the sprite is set to the newly created sprite. (This all happens during Editor time with editor scripts).The sprite seems to be in scene with no issues (is drawn properly), the spriteRenderer shows an anonymous sprite in it's sprite field (The sprite just shows the icon and has no name). This is all part of some larger prefab. So I save the prefab and then realize the sprite i created is not saved onto it. How can I have it apply on the prefab properly?
Answer by ImperialDynamics · Nov 13, 2019 at 11:49 AM
this is a really old post but i'm having a similar issue in 2019. I use Sprite.Create in an editor script and assign it to the spriterenderer of an object but it says None (meaning null) even before i hit play (null in editor mode). Perhaps Sprite.Create doesn't work in editor scripts for some reason?