Hi i have a problem, when my player flips it changes from one side to the other side of the scene, it does change the orientation but it changes position, can anyone help? When i put -1,1,1 it changes my sprite position to the other side of the scene, it flips the character but in another position. It’s in an empty object
Well, this behavior is expected, but the solution depends on your project setup.
So this either comes from the sprite pivot not being in the center, or from the child objects not being centered around 0,0,0. It seems you’re trying to flip the parent object, and the child objects are relative to that, so they’ll change their entire position. You can’t just change the parent scale and expect everything to “flip” in place.
You could use the Flip property on the Sprite Renderer or, what I’m guessing, need to take every single child object and center it around the exact center of the parent. it seems like you have an offset in there that’s multiple units long.
I was days searching about that issue. A partner talked to me in regards of relative position between parent and child game objects. When I read your comments, I knew what I have to do. Well, I had to create again a new game object for my player and position it at 0,0,0. After that create bones with the component. It works fine, thanks. However I want to know if it’s possible to correct that local reference once you have been created and configured the whole Game Object (I mean with rigidbody, colliders, animators, etc).
It’s always possible to correct anything.
In the best case you can figure out what needs correcting by studying what is in front of you and changing a minimal number of things.
In the worst case you have to rebuild it all from scratch.
What is not possible is for strangers here to describe the exact abilities you have for a problem that you have described in one sentence.
To be successful, you must find a way to get the information you need in order to reason about what the problem is.
What is often happening in these cases is one of the following:
- something isn’t parented properly
- something isn’t offset properly
- the code you think is executing is not actually executing at all
- the code is executing far EARLIER or LATER than you think
- the code is executing far LESS OFTEN than you think
- the code is executing far MORE OFTEN than you think
- the code is executing on another GameObject than you think it is
To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.
Doing this should help you answer these types of questions:
- is this code even running? which parts are running? how often does it run? what order does it run in?
- what are the values of the variables involved? Are they initialized? Are the values reasonable?
- are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)
Knowing this information will help you reason about the behavior you are seeing.
You can also put in Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene
You could also just display various important quantities in UI Text elements to watch them change as you play the game.
If you are running a mobile device you can also view the console output. Google for how on your particular mobile target.
Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.
Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:

