Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Texture2D.ReadPixels() call in Coroutine

Discussion in 'Developer Preview Archive' started by mulova, Oct 18, 2012.

  1. mulova

    mulova

    Joined:
    Apr 14, 2011
    Posts:
    58
    In 4.0b07, Coroutine containing Texture2D.ReadPixels() call works well,
    But in 4.0b11, it throws an error.

    ReadPixels was called to read pixels from system frame buffer, while not inside drawing frame.
    UnityEngine.Texture2D:ReadPixels(Rect, Int32, Int32, Boolean)
    $:MoveNext() (at Assets/Standard Assets/Scripts/ScreenWipe.js:94)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)

    Is it deprecated or a bug?
    What should I have to do to avoid this?
     
    Last edited: Oct 18, 2012
  2. mulova

    mulova

    Joined:
    Apr 14, 2011
    Posts:
    58
    Solved by adding "yield new WaitForEndOfFrame();" before ReadPixel
     
    Razek07 likes this.
unityunity