Before updating to Windows 10 you may need to return your Pro license. More information here

Unity 4.3 2D Animation Question


I have an animation built up of individual sprites, like how the Unity 2D demo "hero" is constructed.

One of the individual sprites in the animation I do not wish to flip when the character changes directions. I would like to flip the character but, right after flip the individual sprite back so that it doesn't flip. Since it is a symbol on the characters chest I don't want it show backwards.

How do I gain access to that individual sprite and reset its flip?

I know how to flip the character. I'm trying to gain access to one of the children in the animation.


more ▼

asked Nov 26, 2013 at 04:34 PM

avatar image

0 1 2 3

Actually, I think I'm close to answering my own question. I'm finding the child transform that I wish. I detach from the parent and let the flip on the rest of the children happen, and then reattach the detached child back.

However, when I attach back the child is flipped. If I don't attach back the child isn't flipped but is abandoned.

Any ideas?

Or is there some kind of layering I should be doing?

Nov 26, 2013 at 05:04 PM RodH

Nope didn't work. I tried detaching the child transform, then do flip (change the scale on localscale), and then re-attach the child. It didn't work.

If you have the Unity demo. Try not flipping the Bazooka since what I'm trying to do is something similar to that. I even tried my idea in the demo and nope, didn't work. Here's what I tried...

void Flip () { // Switch the way the player is labelled as facing. facingRight = !facingRight;

     Transform theBazooka = transform.Find("Bazooka");

             // detach child
     theBazooka.parent = null;

     // Multiply the player's x local scale by -1.
     Vector3 theScale = transform.localScale;
     theScale.x *= -1;
     transform.localScale = theScale;

             // re-attach child
     theBazooka.parent = transform;
Nov 26, 2013 at 07:03 PM RodH

why you detach bazooka before flipping?

Nov 27, 2013 at 08:47 AM yatagarasu

I'm not detaching the bazooka. I was using that as an example to explain my predicament.

I have an animation that is built up like the one in the 2d unity demo. My character has a symbols that I didn't want flipped.

Nov 27, 2013 at 02:47 PM RodH
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You should parent both character and symbol from one GameObject to keep them linked and flip only character.

Or flip character and flip symbol, so symbol would be double flipped.

How you flipping the character, by applying negative scale?

more ▼

answered Nov 26, 2013 at 05:14 PM

avatar image

574 21 33 80

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Nov 26, 2013 at 04:34 PM

Seen: 2473 times

Last Updated: Nov 27, 2013 at 02:47 PM