Sprite pivot reset at script creation: camera transparency sorting problem (5.6.2p4)

Hello people! I’m posting a thread here because I encountered a weird bug while trying to order sprites using Camera.transparencySort.

My goal here is to create sprites, and use the Camera’s transparency sorting to display the sprites using their bottom. This is the code I used to change the Camera’s transparency sorting. This code snippet is reached, as the priority is taken in account:

Camera.main.transparencySortMode = TransparencySortMode.CustomAxis;
Camera.main.transparencySortAxis = new Vector3(0.0f, 1.0f, 1000000.0f);

My system creates Sprite objects on the fly using that function:

Texture2D SpriteTexture = new Texture2D(1, 1);
SpriteTexture.LoadImage(FileLoader.getBytesFrom(filename));
SpriteTexture.filterMode = FilterMode.Point;
SpriteTexture.wrapMode = TextureWrapMode.Clamp;
Sprite newSprite = Sprite.Create(SpriteTexture, new Rect(0, 0, SpriteTexture.width, SpriteTexture.height), new Vector2(0.5f, 0), 100);

Whether the sprites are created, I set it to a SpriteRenderer object (and not an Image object), but the sprite’s info still says the Sprite object’s pivot is Center:

After some researches, I saw there was a solution with some buttons on the Editor but it doesn’t seem to work either. Maybe I messed it up? I’ll send an image just to be sure:

Finally, this is what I have after all of this:

And I’d really love to have that blue rectangle being displayed above the red rectangle, while it’s bottom y position is above the red rectangle’s bottom y position.

Is there any way to achieve that? Did I screwed up something? Maybe you guys need more infos about my code and how I do things? Plase answer me as soon as possible, I’m on that problem for 4 day straight now :confused:

Can’t you just move it down in the hierarchy and let the UI RenderQueue voodoo take care of it? SetSiblingIndex ought to sort you…

Argh, ouch. Sorry, it seems I messed up something in the presentation of my problem.

For this kind of sprite, I don’t use UI Images but SpriteRenderers.

I use Images for other things in my project. Sorry for mixing up.

This is what I have right now, several SpriteRenderer objects that I want to order by their bottom position.