Hello everybody, I’m french so sorry for my eventual mistakes.
I have a object who is called “BaseBurger” with his own SpriteRenderer.
This object have a child SpriteRenderer who is called “TopBurger”.
When I operate a position change of my child TopBurger, the parent BaseBurger follow it.
I thought only childs follow their parent but not in the opposite situation …
Here, in the Start() method, I puted two distinct Vector2 positions for each sprite :
spriteBurger = GetComponent<SpriteRenderer>();
mPosition = spriteBurger.transform.position;
spriteTop = GetComponentInChildren<SpriteRenderer>();
topPosition = spriteTop.transform.position;
Further away in my code, I created a method to separate each part of my Burger like this :
public void PlacePickle()
{
topPosition.y += 3f;
spriteTop.gameObject.transform.position = topPosition;
//isPickleAnimPlacing = true;
}
The problem, as I said at the beginning, it’s that my parent object ( the BaseBurger ) follow my TopBurger sprite child too…
Anyone can explain to me which is my error ?
Thanks a lot and if i’m unclear, ask me for more practical informations.