07th-mod / 07th-mod/higurashi-assembly

Releasing the "windo_filter" texture, then using it again causes it to be replaced with a sprite displayed on screen

未關閉
#51 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
12
分支
12
PR 合併指標
30 天內沒有已合併 PR

描述

Disclaimer: I haven't tested this on the stock game, so it could be some other of my changes which causes this to happen. Also, it's not possible? for this to happen on the base game, but it is more of a "annoying for developers" thing.

Currently, before we switch window filters (the background for the textbox), we call ReleaseTextures(); just before it:

https://github.com/07th-mod/higurashi-assembly/blob/2393805e12f5c4c8fd95140303228ec613ec701a/Assets.Scripts.UI/MainUIController.cs#L477-L480

When testing my own code, I found that if you call this twice with "windo_filter" as the image, it can result in this happening.

![sprite_as_window](https://user-images.githubusercontent.com/1249449/97796837-02dc4300-1c6b-11eb-9332-bf03846d6a04.JPG)

It only happens with "windo_filter" in particular, because there is a hardcoded cache for that particular image in: https://github.com/07th-mod/higurashi-assembly/blob/2393805e12f5c4c8fd95140303228ec613ec701a/Assets.Scripts.Core.AssetManagement/AssetManager.cs#L242-L245

However, if you remove the ReleaseTextures();, then the problem goes away.

I'm guessing that if you call releaseTextures on windo_filter, it doesn't invalidate (it doesn't set windo_filter to null), and when the game tries to use that texture, it ends up using some random texture instead.

~~I could either fix this by disabling the caching (currently you're not caching the ADV/NVLADV textures), or adding an extra condition check which disables the cache.~~ **Edit: If I just use a third type and switch ADV->NVL->OG->ADV... then the problem goes away so I guess it's not really an issue for now.**

I don't think this is related to #45 even though it looks similar, because the sprite appears slightly transparent (it draws it with the window opacity).

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

該問題指向 MainUIController.cs 第 477-480 行和 AssetManager.cs 第 242-245 行。首先檢查 ReleaseTextures() 呼叫以及為 'windo_filter' 硬編碼的快取。透過使用 'windo_filter' 呼叫 ReleaseTextures 兩次並觀察紋理替換來重現該錯誤。檢查快取是否在釋放時被正確設為無效。執行遊戲以查看精靈是否顯示為視窗背景。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, unity
領域
computer-graphics, game-dev
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。