void OnPostprocessTexture(Texture2D texture)
{
GameObject go = new GameObject(“TEST”);
SpriteRenderer sr = go.AddComponent();
sr.sprite = Sprite.Create(texture, new Rect(0,0,500,500), new Vector2 (0.5f, 0.0f));
}
The above sample code does not work properly. The sprite does not point to any Sprite texture. The SpriteRenderer’s sprite points to none in the Inspector. However it seems like the data was valid while walking through the code. What is the problem here?