Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Animated sprite and Tiled draw mode causes size to reset on play

Discussion in '2D' started by MidievalMan, May 13, 2024.

  1. MidievalMan

    MidievalMan

    Joined:
    Jul 1, 2020
    Posts:
    6
    Hi, I'm trying to add an animated background to my project, so I animated it and wanted to tile the animation using the Sprite Renderer's tiled draw mode. I sized it up and it looked fine while I was in edit mode, but as soon as I pressed play, the size got changed to 1.28x1.28 again. I imagine it's some problem with the animator overwriting the Sprite Renderer's data, but I'm not sure how to get the sizes that I put in to stay. The object has no scripts attached or anything, it is very simple.

    I'm looking into using animated tiles or perhaps updating the size on the sprite renderer via a script at runtime, but the way I'm currently approaching it would be by far the simplest for me. Any insight would be much appreciated, thanks!
     
  2. MidievalMan

    MidievalMan

    Joined:
    Jul 1, 2020
    Posts:
    6
    Update: I wrote a quick script just setting the draw mode and size and it worked. If anyone sees this and still has any insight into why the animator changes the draw mode or what else may be going on feel free to share!
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,327
    Perhaps you have
    (X) Write Defaults
    checked on the animation state itself?

    Screen Shot 2024-05-13 at 4.44.46 PM.png