This MGFX effect was built for a different platform! (TiledMapRenderer)

Hello. Recently I faced a problem: system exception - “This MGFX effect was built for a different platform!”.
I searched this one and found similar topic, but unfortunately I hadn’t found a clear way to solve the problem. (For now I’m a stranger to graphics and effects, so have not enough knowledge how tiled maps connected with OpenGl, DirectX and stuff like that)
I think, that it wouldn’t be a bad idea to share my code in seek of help (Maybe there are some mistakes that are the root of the problem)
Game1.cs

public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    State CurrentState;
    TiledMapRenderer renderer;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    void SetState(State state)
    {
        
        CurrentState = state;
        CurrentState.Init(Content);
        
    }

    protected override void Initialize()
    {
        SetState(new MenuState());
        graphics.PreferredBackBufferWidth = 1920;
        graphics.PreferredBackBufferHeight = 1080;
        graphics.IsFullScreen = false;
        graphics.ApplyChanges();
        base.Initialize();
    }

    protected override void LoadContent()
    {
        
        renderer = new TiledMapRenderer(GraphicsDevice);
        spriteBatch = new SpriteBatch(GraphicsDevice);
        
    }

    protected override void UnloadContent()
    {

    }

    KeyboardState oldState;

    protected override void Update(GameTime gameTime)
    {
        KeyboardState newState = Keyboard.GetState();

        var delta = (float)gameTime.ElapsedGameTime.TotalSeconds;

        CurrentState.Update(delta);

        if (CurrentState is MenuState && (newState.IsKeyDown(Keys.F) && oldState.IsKeyUp(Keys.F)))
            SetState(new Level1(renderer));
        if (CurrentState is MenuState && (newState.IsKeyDown(Keys.Escape) && oldState.IsKeyUp(Keys.Escape)))
            this.Exit();
        if (CurrentState is Level1 && (newState.IsKeyDown(Keys.Escape) && oldState.IsKeyUp(Keys.Escape)))
            this.Exit();

        base.Update(gameTime);

        oldState = newState;
    }

    
    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.White);
        CurrentState.Draw(spriteBatch, graphics);
    }
    
}

Level1.cs

class Level1 : State
    {
    private GraphicsDevice graphicsDevice;
    private TiledMap map;
    private TiledMapTileset tileset;
    private TiledMapRenderer renderer;
    private Camera2D cam;
    private Texture2D vanya;
    public Player player;
    public OrcMob orc;

    public Level1(TiledMapRenderer rend)
    {
        this.renderer = rend;
    }

    public void Init(ContentManager content)
    {
        
        player = new Player();
        orc = new OrcMob();
        orc.Init(content);
        orc.enemy = player;
        player.Init(content);
        vanya = content.Load<Texture2D>("Vanya");
        
        map = content.Load<TiledMap>("testmap");
        cam = new Camera2D(graphicsDevice);

    }

    public void Update(float delta)
    {
        player.Update(delta);
        orc.Update(delta);
    }

    public void Draw(SpriteBatch sb, GraphicsDeviceManager graphics)
    {
        var viewMatrix = cam.GetViewMatrix();
        var projectionMatrix = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width,
           graphicsDevice.Viewport.Height, 0, 0f, -1f);


        player.Draw(sb);
        orc.Draw(sb);
        renderer.Draw(map, viewMatrix, projectionMatrix, null, 0);
        sb.Begin();
        sb.Draw(vanya, new Vector2(300, 300), Color.Black);
        sb.End();
    }
}

See 351. The problem is fixed in pre-release NuGet packages.

Thank you! I installed pre-release Monogame.Extended and now it works :slight_smile: