r.mirzojonov
r.mirzojonov

Reputation: 1249

Error loading. Cannot open file

I'm new to XNA game development and I've faced a problem that couldn't solve even by searching on the internet. I wanted to load my model but every time it gives me this exception: ContentLoadException was unhandled. Here is my code:

 Model model = Content.Load<Model>(@"\Models\hero"); // and file is in fbx format

This is the screenshot of my solution enter image description here

Upvotes: 0

Views: 700

Answers (1)

Monacraft
Monacraft

Reputation: 6620

Try this:

Model model = Content.Load<Model>(".\\Models\\hero");

What you're doing is perfectly fine. Just try doing it Exactly the way Microsoft suggests at the MSDN Examples Section. If it still doesn't work, you can know for sure there is something wrong on your part. Try placing the Model in the same directory so you can just:

Model model = Content.Load<Model>("hero");

And if that still doesn't work, you know the problem is somewhere else.

Upvotes: 1

Related Questions