Could not render my model

Hi,

I am generating a model at runtime and I need to render it.
I am not using GameStudio. I doing everything with code. (CodeOnlySample style)

The below is my code for my game. I am adding a model component to my scene and I am assuming that Xenko will take care of rendering my model. But I am getting blank screen.

Please assume that the model that I am generating has no flaws. Am I missing anything else here? (Like specifying lights, cameras etc…). I really need help here in fixing the issue.

Thanks in advance.

 public class DummyGame : Game
    {
        private Model BuildModel()
        {
            var model = //// Some model building logic.
            return model;
        }

        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var model = BuildModel();
            var modelComponent = new ModelComponent
            {
                Model = model,
            };

            var scene = new Scene();
            scene.Entities.Add(new Entity { modelComponent });
            SceneSystem.SceneInstance = new SceneInstance(Services, scene);
        }
    }

Dear @tonfilm,

Can you please answer this question too?

Thanks in advance.

yes, you need camera and lights. the easiest way is to create a simple game with game studio which has the basics set up and then continue to work in visual studio. you won’t need game studio after that anymore. everything is done by the msbuild system in visual studio. it’s just much easier to get a basic game setup to start with game studio.

1 Like

Hi @tonfilm,

It worked perfectly after following your guidelines.
Thanks a lot.