Grab project content from Monodevelop

Asked

Viewed 21 times

1

I’m trying to insert a PNG image in my game, but I’m not getting it, the image is in Content/alien.png, with the code below:

Texture2D alien;
.
.
.
protected override void LoadContent ()
{
    spriteBatch = new SpriteBatch (GraphicsDevice);
    Content.RootDirectory = "Content";
    alien = Content.Load<Texture2D>(@"alien");
}

When I run the game, the error message appears:

Microsoft.Xna.Framework.Content.Contentloadexception: Could not load alien Asset as a non-content file! ---> Microsoft.Xna.Framework.Content.Contentloadexception: The directory was not found. ---> System.IO.Directorynotfoundexception: Could not find a part of the path "/home/Leonardo/Documentos/Mono/Maisum/Maisum/bin/Debug/Content/alien.xnb". At System.IO.Filestream.. ctor (System.String path, System.IO.Filemode mode, System.IO.Fileaccess access, System.IO.Fileshare share, System.Int32 bufferSize, System.Boolean Anonymous, System.IO.Fileoptions options) [0x001cf] in :0 at System.IO.Filestream.. ctor (System.String path, System.IO.Filemode, System.IO.Fileaccess access, System.IO.Fileshare share) [0x00000] in :0 at at (wrapper remoting-invoke-with-check) System.IO.Filestream:. ctor (string,System.IO.Filemode,System.IO.Fileaccess,System.IO.Fileshare)
At System.IO.File.Openread (System.String path) [0x00000] in :0 at Microsoft.Xna.Framework.TitleContainer.Openstream (System.String name) [0x00029] in :0 at Microsoft.Xna.Framework.Content.Contentmanager.Openstream (System.String assetName) [0x0002e] in :0 --- End of Inner Exception stack trace --- at Microsoft.Xna.Framework.Content.Contentmanager.Openstream (System.String assetName) [0x00053] in :0 at Microsoft.Xna.Framework.Content.Contentmanager.Readasset[T] (System.String assetName, System.Action1[T] recordDisposableObject) [0x00073] in <c33f6c525d914593acc9b590397e7c2b>:0 --- End of inner exception stack trace --- at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T] (System.String assetName, System.Action1[T] recordDisposableObject) [0x0012b] in :0 at Microsoft.Xna.Framework.Content.Contentmanager.Load[T] (System.String assetName) [0x00068] in :0 at Game1.Loadcontent () [0x0002e] in /home/Press release/Documents/Mono/Maisum/Maisum/Game1.Cs:46 at Microsoft.Xna.Framework.Game.Initialize () [0x0004d] in :0 at Maisum.Game1.Initialize () [0x00002] in /home/Leonardo/Documentos/Mono/Maisum/Maisum/Game1.Cs:35 At Microsoft.Xna.Framework.Game.Doinitialize () [0x00011] in :0 at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.Gamerunbehavior runBehavior) [0x00033] in :0 at Microsoft.Xna.Framework.Game.Run () [0x0000c] in :0 at Maisum.Program.Rungame () [0x00010] in /home/Press release/Documents/Mono/Maisum/Maisum/Program.Cs:31 at Maisum.Program.Main (System.String[] args) [0x00001] in /home/Press release/Documents/Mono/Maisum/Maisum/Program.Cs:55

Probably and error is because it expects a file . xnb, but I have only one . png, because on Linux I did not find a way to convert. Could someone help me?

Information: Linux Elementary OS Freya Monodevelop 5.10 Monogamy

2 answers

0


I figured it out, I figured I had to open the Pipeline Content, simply opening the file Content.mgcb, adding my contacts to it and clicking on Build, but I had problems with the build, it was failing, so I installed the Monogamy over the 3.5, after that I erased the 3.4, and installed the 3.5 again, it worked. It may be some files that were not extracted during the first installation.

0

This really causes a lot of confusion, because in XNA it was only necessary to create a folder and put the files inside (only with the audio file it was necessary to use XACT) already in Monogame all the files must be added/converted through the "Monogame Pipeline". IPC.: Don’t forget to make the appropriate settings in the properties of the file (building, copy Always, etc.) because this also gets in the way of adding the files.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.