#Image in Sprite Renderer is removing itself when starting the game
1 messages · Page 1 of 1 (latest)
check your scripts, one of them might be deleting the image by accident
Can you give more information? Sprite Renderers only have one slot for a sprite, so I think you might be referring to the wrong thing.
No, an sprite from the spritesheet, which is like cutted, the other sprites from that spritesheet are working
I unpacked it from a prefab, and there the sprite renderer works
To get the information right;
- You've got a sprite sheet that you sliced. You sliced the sprite sheet by setting the sprite type in the import settings to Multiple, and then using the Sprite editor.
- When you use sprites from this sheet in a sprite renderer, one of the sprites works, and the other does not.
Is that right? If so, check that you sliced the sprite sheet correctly. In your Assets window, you should see an arrow next to the sprite sheet. If you open that, you should see your two sprites in there.
Yes you've got it right.
I sliced it correctly, and when I add to the Sprite Renderer, I see it in the editor, but it gets removed from the Sprite Renderer after starting the game.
When you say it gets removed, do you mean that it then displays None (Sprite) in the inspector?
Yep
The only thing I can think of is that you've got a script attached to the GameObject that changes which sprite is set in the Sprite Renderer. Do you have any scripts attached to the gameobject or referencing the sprite renderer?
No, it's only referencing to the box collider 2D
Could you post a video?