0
\$\begingroup\$

So i want to figure out a way to use the ContentManager.Load method with full directory paths, so lets say

Content.Load<T>(@"Images\SomeImage");

becomes

Content.Load<T>(@"C:\Users\UserName\Documents\Visual Studio 2013\Projects\MyProject\Content\SomeImage");

Thanks in advance.

\$\endgroup\$
  • \$\begingroup\$ The resources are packaged with your game and you have no control over where its installed if you distribute it. I don't see a practical application for doing this. \$\endgroup\$ – ClassicThunder Nov 24 '14 at 0:21
  • \$\begingroup\$ Why do you want to do this? It seems extremely limiting and pointless. \$\endgroup\$ – Josh Nov 24 '14 at 1:49
  • \$\begingroup\$ Given the map-editor tag, and his previous question, I think he wants to load a precompiled asset from outside of the application/games content directory. \$\endgroup\$ – Seta Nov 24 '14 at 3:14
  • \$\begingroup\$ Fair enough, seems you would just want to load them in with Texture2D.FromStream in that case though. Additionally since you would probably want to package the images with the map coping the images to the content directory to group them with the associated map. \$\endgroup\$ – ClassicThunder Nov 24 '14 at 15:19
1
\$\begingroup\$

Set Game.Content.RootDirectory to the path you want and then just specify the file name portion. But keep in mind that you still have to include them in the Content project.

If you don't want to/can't do that, then forgo the ContentPipeline altogether.

\$\endgroup\$

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.