Problem with Initial Walk-through - no ball!

Fairly experienced programmer here but first time with Monogame. My setup is Windows 10 VS 2019 with Xamarin Android installed. I’ve setup Monogame in VS 2017 and was able to open it in VS 2019 (copied all templates) and run it on an Android emulator. So far so good. It runs with the corn blue screen showing.

I then started on the moving ball example. Downloaded the ball, opened up Content.mgcb in the Pipeline tool. This is the adding content page. But I didn’t get the Add File Action dialogue (I’m guessing because I put the ball in Content folder).

I added all the code on the page LoadContent and Draw, rebuilt and ran but no ball. Is there somewhere I should put it?

Which moving ball example are you referring to?
Hard to be sure what might be the issue without code or references.

But if you’re trying to add a texture file in the pipeline tool, right-click on ‘content’ on the left and you can add folders, or ‘new item’. Do ‘new item’, then go grab your texture using the file dialog that pops up and then run the build option at the top. If you aren’t running build then you aren’t converting anything to a usable xnb file. Not sure if you did that step, but a build is needed.

Once you’ve built the content, you can then reference it with Texture2D texture = Content.Load<Texture2D>(FILE_PATH_HERE). By default, the file path in the ContentManager (Content) member in your Game1 class is relative to your project folder. So if your ball texture is in the root directory, just Load(balltexturename) is all that’s needed. No extensions required.

just stuff that reference somewhere in the body of your Game1. In Draw, you should only need to do this:

Spritebatch batch = new Spritebatch(GraphicsDevice);
batch.Begin();
batch.Draw(texture, new Vector2(0,0), Color.White);
batch.End();

If you’ve done all that and still don’t see the ball texture, nor are you getting any errors… then that’s weird.

Another way to test things to be sure everything is working okay would be to draw a primitive instead.

Instead of loading a texture, you’d do this:

Texture2D texture = new Texture2D(GraphicsDevice, 1, 1);
texture.SetData<Color>(new Color[] { Color.Red } );

Then in the draw, you’d define a rectangle instead of using the vector. If you don’t define a rectangle, using a primitive this way will result in a 1x1 px rectangle.

batch.Draw(texture, new Rectangle(0,0, 200, 200), Color.White);

If you do this, you ought to see a red square in the top-left corner. If THAT doesn’t work, then something is really messed up.

Thank you for the replay. It was on this page. I’ll give your suggestions a try.

Hm yeah, that example pretty much covers everything I suggested. If you’re running build and successfully converting the texture to xnb, then loading the texture as it suggests should show the ball texture.

Just an update. It didn’t work for me. A week later I tried again and found I needed an update. After that I tried again, and it built and ran ok and also ran on an old Phone I have. Most bizarre but all is good now. Thanks!