UltravioletFramework / ultraviolet

The Ultraviolet Framework is a .NET game development framework written in C#.
https://github.com/UltravioletFramework/ultraviolet/wiki
MIT License
542 stars 46 forks source link

Content folder not copied when building #121

Closed LsHallo closed 4 years ago

LsHallo commented 4 years ago

Hello, I've just started using the framework and I've successfully gotten to the cornflower blue window. No I wanted to load a texture (png file 64x31px) and created a Content folder in my solution. I've then used

this.content = ContentManager.Create("Content");  
Debug.WriteLine(content.FullRootDirectory);  
if (content.Preprocess<Texture2D>("0001.png", true))  
{  
    Debug.WriteLine("Asset was preprocessed");  
    _0001 = content.Load<Texture2D>("0001");  
}  

This however results in a FileNotFoundException. The path used is %project_root%\bin\Debug\Content. When I'm manually taking a look at the bin\Debug directory there is no Content folder there. If I manually copy the content folder over the code works just fine. I could not find any reference in Example4 that would help me so that the content folder is also copied when building.

I've also tried using google but ultraviolet seems like a rather unfortunate name: https://www.google.com/search?q=ultraviolet+content+folder+not+copied+build https://www.google.com/search?q=ultraviolet+build+setup

Is there any forum or discord server where help is available?

tlgkccampbell commented 4 years ago

Hi, thanks for your interest in Ultraviolet. If you want a place where you can ask others for help, I recommend our Gitter.

It sounds like the properties for your content files aren't set correctly. Select the file in Visual Studio and in the property window, make sure that Build Action is set to None and Copy to Output Directory is set to Copy if newer.

There used to be documentation around this, but over the years as I've shuffled things around I guess it's gotten lost. I'll make a note to make some improvements in this area.

Please let me know if that doesn't solve your issue!

LsHallo commented 4 years ago

Yes that did the trick. Do I need to do this for every sprite I'm using or is there a general way to mark that directory? Have never used a "real" build process. Only experience with Java, Python and Javascript.

LsHallo commented 4 years ago

Closing this as all my issues have been resolved.