Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/octopus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Octopus Review

on:
pull_request:
types:
- opened
- synchronize
- reopened

permissions:
contents: read
pull-requests: write

jobs:
review:
runs-on: ubuntu-latest

steps:
- name: Run Octopus Review
uses: octopusreview/action@v1
with:
# Public Repoなら不要
# Private Repoの場合のみ設定
octopus-api-key: ${{ secrets.OCTOPUS_API_KEY }}

# 日本語レビュー
review-language: "ja"

# Unity/C#向けチューニング
extra-instructions: |
**必ず日本語のみでレビューしてください。英語は使わないでください。**
You MUST respond in Japanese only. Do not use English.


レビューは簡潔にしてください。
重大な問題を優先してください。

以下を重点的に確認:
- NullReferenceException の可能性
- GC Alloc
- Update/LateUpdate/FixedUpdate内の重い処理
- LINQ多用
- foreach boxing
- async/await の例外処理
- async void
- UniTaskの誤用
- IDisposable/NativeArray の Dispose漏れ
- Addressables誤用
- Unity main thread問題
- ScriptableObject誤用
- イベント購読解除漏れ
- メモリリーク
- パフォーマンス問題
- マルチスレッド問題
- URP互換性
- Shader負荷

以下は指摘しない:
- 命名スタイル
- コメント不足
- 個人の好みレベルの設計
- 過剰なリファクタ提案
- 小さなコードスタイル
- var使用有無
- 改行位置
- インデント
- using順
- trivialな最適化

Unity特有の問題を優先してください。

明確な問題のみ指摘してください。
推測ベースの指摘は避けてください。
9 changes: 3 additions & 6 deletions Assets/Runtime/Scripts/Log/ErrorIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@ protected override void Awake()

protected override void OnEnable()
{
if (SDSettings.Instance.IsShowErrorIndicator)
{
Application.logMessageReceived += OnLogMessageReceived;
}

Application.logMessageReceivedThreaded += OnLogMessageReceived;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Subscription occurs even when IsShowErrorIndicator is false, wasting callback overhead

The original code only subscribed to logMessageReceived when IsShowErrorIndicator was true. The new code subscribes unconditionally and checks the flag inside the handler. While functionally equivalent, this means every log message (including verbose Info logs at high frequency) will invoke the handler and read SDSettings.Instance even when the feature is disabled. If the setting is stable at runtime, restoring the conditional subscription in OnEnable is the lower-overhead pattern. If the setting can change at runtime, consider caching it or using a property-change event.

Suggested change
Application.logMessageReceivedThreaded += OnLogMessageReceived;
protected override void OnEnable()
{
if (SDSettings.Instance.IsShowErrorIndicator)
{
Application.logMessageReceivedThreaded += OnLogMessageReceived;
}
Clear();
}
AI Fix Prompt
Fix the following Medium (Performance) issue in `Assets/Runtime/Scripts/Log/ErrorIndicator.cs` at line 22:

Problem: The original code only subscribed to logMessageReceived when IsShowErrorIndicator was true. The new code subscribes unconditionally and checks the flag inside the handler. While functionally equivalent, this means every log message (including verbose Info logs at high frequency) will invoke the handler and read SDSettings.Instance even when the feature is disabled. If the setting is stable at runtime, restoring the conditional subscription in OnEnable is the lower-overhead pattern. If the setting can change at runtime, consider caching it or using a property-change event.

Suggested fix:
protected override void OnEnable()
{
    if (SDSettings.Instance.IsShowErrorIndicator)
    {
        Application.logMessageReceivedThreaded += OnLogMessageReceived;
    }
    Clear();
}

Clear();
}

protected override void OnDisable()
{
Application.logMessageReceived -= OnLogMessageReceived;
Application.logMessageReceivedThreaded -= OnLogMessageReceived;
Clear();
}

private void OnLogMessageReceived(string condition, string stackTrace, LogType type)
{
if (!SDSettings.Instance.IsShowErrorIndicator) return;
if (type is not (LogType.Error or LogType.Exception or LogType.Assert) || _isBlinking) return;
HasError = true;
StopAllCoroutines();
Expand Down
Loading