I tried different tutorial and then tried to apply it to a very small project.
My problem is that the collision box I defined around the player sprite changes its position at runtime.
Here are two screenshots: during design and during runtime.
Can you attach a screenshot of your inspector for the sprite, & do you have any scripts running or is the 2nd screenshot showing what happens when all you have in the scene is the sprite & no scripts attached?
I have scripts to handle movement and animation.
If it’s useful, I don’t mind to share the whole project, but is it possible just with the forum upload method ?
No idea, it looks fine to me & I’ve never had this issue. I have had the problem of confusing myself with the collider & the outline of the sprite but this looks like your collider is resetting to the centre of your sprite. Do the collider size&/or x/y axis numbers change in the inspector when you run the scene?
I’ve also had the issue where the animation runs ahead of the character controller & collider. If you disable the animator, or remove it, & drag the character up does the collider change when the character is falling to the ground? If the collider stays around the player when there’s no animation then that could indicate where your issue is.
This is because your sprites have different pivot settings.
In the GameObject SpriteRenderer the sprite (astroWalkRight) has the pivot on top left while the sprites used in the animation has the pivot set to center.
I think I understand what you wrote, now I need to understand with Unity open to see where those pivot settigns are.
Thanks anyway, it gives me something to search and try
Thanks a lot Leoyalk, i just add to open the sprite editor to fix the pivot, remove the offset I tried in the collision box and everything is perfect now.
Do a position check & then transform.position the player to the other side of the screen or try doing it when it isn’t visible by the camera anymore if the camera doesn’t follow the player.
That’s what I’ve done.
For the moment, it will be enough. I’ll see later if I try a more complex behavior with some cloned sprite.
Maybe it’s time for me to open a post in the Work In Progress section