2015-01-26 54 views
2

我正在嘗試在Monogame程序中繪製文本。我想使用SpriteFont來做到這一點,但是當我嘗試加載SpriteFont時出現以下錯誤。錯誤 - 未實現SpriteFont

//Here I try to load the SpriteFont 
//It is kept in the "Content/fonts" folder, with "Content" as the Content.RootDirectory 
Font = Content.Load<SpriteFont>("fonts/SpriteFont1"); 

//I then get this error 
An unhandled exception of type 'System.NotImplementedException' occurred in MonoGame.Framework.dll 
Additional information: The method or operation is not implemented. 

將SpriteFont1構建操作設置爲「Content」,並將其複製到輸出目錄爲「始終複製」。 SpriteFont1.xnb文件位於Content文件夾中,具有相同的設置。我如何解決這個錯誤,以便我可以加載SpriteFont?

+0

方法沒有實現。這可能在Mono庫中。堆棧跟蹤將顯示哪種方法。 – 2015-01-26 23:31:40

+0

我編輯了你的標題。請參閱:「[應該在其標題中包含」標籤「](http://meta.stackexchange.com/questions/19190/)」,其中的共識是「不,他們不應該」。 – 2015-01-27 00:33:13

回答

5

簡單修復。在堆棧跟蹤之後(感謝Richard Schneider),我發現SpriteFont1.xnb文件需要與實際的.SpriteFont文件位於同一文件夾中。

0

實際上,只需要.xnb文件,因爲它是從.SpriteFont編譯的,因此您應該只將.xnb文件複製到Content文件夾。

NotImplementedException是因爲LoadContent沒有實現直接加載.SpriteFont文件。 (在MonoGame 3.5中測試)