0
\$\begingroup\$

So i am bulding a game editor/engine basically for teh lulz but i have encountered a problem i cannot seem to fix, i cannot load any new content through the Winforms UI during runtime.

I tried using the File.Copy method in .Net to copy the files to the content folder but this does not seem to work as the file needs to be added to the content project in order for my ContentManager object to read it.

Any thoughts on how to fix this?

\$\endgroup\$
2
\$\begingroup\$

Dynamically importing and processing content at runtime is explained in the sample WinForms Series 2: Content Loading. This is the preferred method.

You can also build an XNA Content Project file using MSBuild. this blog post explains how. You can create a temporary project file, so you don't need to modify or rebuild files in your Solution.

Additional information in this blog post. It helpfully explains the layers of the XNA Content Pipeline (so you can decide what layers it would be best to interface with to meet your requirements).

\$\endgroup\$
0
\$\begingroup\$

In Visual Studio...

  1. Right mouse click on the Content Project
  2. Select 'Add' then 'Existing Item...'
  3. Navigate to the folder containing your content, change the filetype from the drop down box if needed, select your content file, then click on 'Add'.
  4. Use your content.
\$\endgroup\$
  • \$\begingroup\$ You misunderstood, i want to be able to add items to the content project in my editor during runtime through the Winforms interface \$\endgroup\$ – Man'OVodka Nov 22 '14 at 19:44
  • \$\begingroup\$ Might pay to mention that you want to add content dynamically during program run time. The project file is an XML file, so it is possible to use an xml reader/writer to modify it, however you won't be able to use the added content until the project itself is rebuilt. Its this rebuild step that has lead me to make my own custom content pipeline so the rest of our team can add models/textures (currently, plan on doing sound/video at some point) without needing to worry about the default XML content pipeline and rebuilding assets. I'll try and prep some xml reader/writer code for you. \$\endgroup\$ – Seta Nov 22 '14 at 19:54
  • \$\begingroup\$ My sincere gratitude, i will try modifying the Content XML file and will probably have to find some kind of a workaround to the rebuilding problem since i am doing this solo and making my own content pipeline seems like a tall order. \$\endgroup\$ – Man'OVodka Nov 22 '14 at 20:09
  • \$\begingroup\$ I have been planing on creating a github repo for my customm pipeline project, so if you want to have a look at it, I can upload it to github and link it to you. Have to do so once I'm back at my computer. \$\endgroup\$ – Seta Nov 22 '14 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.