Search Issue Tracker

Fixed in 4.5.X

Votes

2

Found in

4.3.3f1

Issue ID

590946

Regression

No

When loading an asset bundle that contains a SpriteRenderer, the sorting layer for the sprite renderer gets reset to default

2D

-

To reproduce:
1. Open attach project
2. Open Test scene
3. Enter play mode
Expected result: The prefab is instantiated and looks same way as the one already in the scene
Actual result: The prefab's sprite renderers lose their sorting layer, so they look different

Comments (5)

  1. Cuicui_Studios

    Jul 29, 2015 14:55

    I´m using Unity 5.1.2p1 and have the same problem. I set the Sorting Layers on Tags & Layers but the SpriteRenderer do not recognize them.

  2. Asema_Khan

    May 08, 2014 11:17

    Here is the temp solution for this issue:

    I have simply attached a script with all the game objects that have Sprite renderer attached with them, the script will simply take a public string which will contain the name of sorting layer and will assign it to the renderer in Awake(). Here is the code and it works well for me after downloading assets from bundle.

    using UnityEngine;
    using System.Collections;

    public class SOA_ChangeSortingLayer : MonoBehaviour {

    public string sortingLayerName;
    // Use this for initialization
    void Awake () {

    SpriteRenderer myRenderer = this.gameObject.GetComponent<SpriteRenderer>();
    if(myRenderer != null)
    myRenderer.sortingLayerName = sortingLayerName;

    }
    }

  3. Asema_Khan

    May 08, 2014 10:15

    Is this issue fixed in 4.3.4 release? If not, can you suggest some alternative solution for this problem?

  4. TomasJ

    Mar 26, 2014 10:48

    Will be fixed in next release.

  5. benhumphreys

    Mar 06, 2014 00:55

    I see this issue also.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.