2014-09-27 50 views
0

我是XNA遊戲開發的新手,我遇到了即使在互聯網上搜索也無法解決的問題。我想加載我的模型,但每次它給我這個異常:ContentLoadException未處理。這裏是我的代碼:加載時出錯。無法打開文件

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

這是我的解決方案的截圖 enter image description here

+0

您是否設置了RootDirectory? 'Content.RootDirectory =「Content」;' – 2014-09-27 19:25:26

+0

@DavorMlinaric是的 – 2014-09-27 19:26:46

+0

您可以顯示內容文件夾結構的圖片嗎? – 2014-09-28 08:51:18

回答

1

試試這個:

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

你正在做什麼是完美的罰款。試試吧就是微軟在MSDN Examples Section上建議的方式。如果它仍然不起作用,你可以確定你的部分有問題。嘗試將模型置於同一目錄中,以便你可以:

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

如果這仍然無法正常工作,你知道問題出在別的地方。

+0

謝謝你編譯,但是沒有顯示我的模型 – 2014-09-28 12:38:31