Hello Guest

Author Topic: Sprite Scales reverting on play  (Read 3577 times)

Amesa

  • Newbie
  • *
  • Posts: 2
    • View Profile
Sprite Scales reverting on play
« on: July 24, 2013, 01:30:00 pm »
Greetings, I'm currently using tk2d in one of my projects. ver.1.92v. for this project I've written some editor code that goes into my objects and checks their components and their values and corrects them if needed. one of these checks is for sprite scales.

In my scenes there are a few objects that were being rotated by giving one of the axis a -1 value. It's been decided that all sprites should be at a scale of 1. so my code goes in, fixes all these sprite scales back to 1, and rotates them using the local transform. after running my code, everything looks fine in the inspector window and scene view. When I hit the play button though, in Unity, all the changes made to the sprite scale are reversed. Even if I were to save the scene before doing so. But every other change that my code made stays, including the transforms. So I end up with objects rotated the wrong way or inside other objects. The odd thing is, if I were to change it manually; select object, goto the tk2d sprite component in the inspector, change the - value to a + and hit enter; it'll keep the change after pressing play. Even if I don't save the scene. I've tried to find out where the change occurs. before entering the tk2dSprite Awake() function, the sprite scale has already been reversed. And the call stack only has the Awake() call in it. Any help on this matter would be greatly appreciated. And many thanks in advance.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Scales reverting on play
« Reply #1 on: July 24, 2013, 02:14:55 pm »
After changing the value, do you set EditorUtility.SetDirty? Try calling that if you haven't already.

Amesa

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Sprite Scales reverting on play
« Reply #2 on: July 24, 2013, 02:57:24 pm »
actually, no, I was not. That fixed it up. Thank you very much good sir/madam.