fix: フォント追加時にリソース定義更新が失敗する問題を修正 - #255
Open
Youkin06 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Resフォルダに独自フォントを追加した状態でリソース定義を更新すると、画像検証処理でInvalidCastExceptionが発生し、フォント定義を生成できない問題を修正しました。発生していた問題
Resフォルダに.ttfファイルを追加した状態で、GameCanvas > リソース定義の強制更新を実行すると、以下のエラーが発生していました。このエラーにより、リソース定義の更新が正常に完了せず、追加したフォントを
GcFont.csに反映できない状態になっていました。原因
画像の検証処理内で、
AssetImporterを直接TextureImporterにキャストしていたため、.ttfなどTextureImporterとして扱えないAssetが含まれている場合にInvalidCastExceptionが発生していました。変更内容
AssetImporterを直接TextureImporterにキャストしないように修正AssetImporterがTextureImporterとして扱える場合のみ画像検証処理を行うように変更TextureImporterとして扱えないAssetはスキップするように変更確認したこと
Resフォルダに.ttfファイルを追加した状態で、リソース定義の更新時にエラーが発生しないことを確認GcFont.csに追加したフォントが反映されることを確認Game.csでgc.SetFont(GcFont.〇〇)を呼び出し、追加したフォントが適用されることを確認