Author Topic: Changing Sprite and TweenPosition Not working properly  (Read 3316 times)

parthpatel1612

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Changing Sprite and TweenPosition Not working properly
« on: June 13, 2014, 11:00:32 AM »
I am trying to change the sprite at runtime and its work properly but when i tried to use TweenPosition.Begin on the parent gameobject then its changes it back to the default sprite and also changes the scale.

I attaching the pictures of what its doing. I am trying to change the top left calculator icon to audio icon.
First pic - default
Second pic - changed sprite - works properly
third pic - when used tween upper left sprite changes back to the calculator sprite and changes the scale.

Let me know what I am doing wrong.

Thank you

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Changing Sprite and TweenPosition Not working properly
« Reply #1 on: June 13, 2014, 09:39:09 PM »
TweenPosition has nothing to do with sprites at all. It's used to move the transform from point A to point B. Your issue lies elsewhere -- possibly in not specifying the sprite's name correctly. Note that it's case sensitive.

gaurav.maniar

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Changing Sprite and TweenPosition Not working properly
« Reply #2 on: July 31, 2014, 01:45:51 AM »
can you tell me how to change sprite or image in UI2DSprite???

thanks
« Last Edit: July 31, 2014, 04:47:07 AM by gaurav.maniar »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Changing Sprite and TweenPosition Not working properly
« Reply #3 on: July 31, 2014, 11:10:10 AM »
GetComponent<UI2DSprite>().sprite2D = someOtherSprite;

gaurav.maniar

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Changing Sprite and TweenPosition Not working properly
« Reply #4 on: August 01, 2014, 12:38:46 AM »
Thanks ...
« Last Edit: August 01, 2014, 02:09:01 AM by gaurav.maniar »