Cannot figure out how to use SpriteBatch in the new release

Using the following with a stock project, I just cant seem to get the spritebatch working. This was no problem in previous versions (versions prior to the new scene stuff from within Paradox).

[STAThread]
private static void Main(string[] args)
{
    using (var client = new Client())
    {
        client.Run();
    }
}

internal class Client : Game
{
    public Client()
    {
        IsFixedTimeStep = false;
    }

    protected override void Initialize()
    {
        base.Initialize();

        Script.Add(new RenderScript());
    }
}

public class RenderScript : Script
{
    private SpriteBatch _spriteBatch;
    private Texture _tile;

    public override void Start()
    {
        base.Start();
    
        _spriteBatch = new SpriteBatch(GraphicsDevice);
        _tile = Texture.New2D(GraphicsDevice, 50, 50, PixelFormat.R8G8B8A8_UInt);

        uint[] colors = new uint[50 * 50];

        for (int i = 0; i < colors.Length; i++)
        {
            colors[i] = uint.MaxValue;
        }

        _tile.SetData(colors);

        var scene = SceneSystem.SceneInstance.Scene;
        var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);

        compositor.Master.Renderers.Add(new SceneDelegateRenderer(RenderQuad));
    }

    private void RenderQuad(RenderContext renderContext, RenderFrame frame)
    {
    _spriteBatch.Begin();
    _spriteBatch.Draw(_tile, new Vector2(500, 500));
    _spriteBatch.End();
    }     
 }

I must be missing something, it’s just not obvious to me. Any ideas?

Ive tried setting the VirtualResolution on the sprite batch since I posted, but this did not help either… still not understanding why this isnt work :frowning:

Have you got a camera set up in the scene?

Did you had a Clear RenderFrame renderer in the graphic pipeline?
If not, I guess you should at least add this line of code in RenderQuad to see something on the screen:

GraphicsDevice.Clear(frame.DepthStencil, DepthStencilClearOptions.DepthBuffer);

1 Like

Do you actually have to do that with SpriteBatch? Seems weird.

Can believe i missed this, clearing the frame solved it. I think over the last few months of using the previous version, most samples had this built in so i didnt even have to think about it, oh well, one of those obvious things you sometimes just dont see, thanks @xenux!