← Zurück zu LÖVE · Projektplanungspaket

Skill · Version 1.0.0

Unity-Speicher und Garbage Collection

Verfolgt Unity-Speicherwachstum über Szenen, Assets und Objektlebenszeiten hinweg. Unterscheidet temporäre verwaltete Belegungen von festgehaltenen Ressourcen, damit die tatsächliche Ursache behoben wird.

unity-game-memory-gc

Agenten mit diesem Skill

Entdecke, wie der Skill hilft

Wann ist der Skill hilfreich?

Nutze ihn bei zurückgehaltenen Objekten nach Levelwechseln, Pools oder asynchroner Arbeit ohne Speicherberuhigung.

Wobei hilft er dir?

  • Trennt verwaltete Allokationen von nativer und Asset-Verantwortung.
  • Vergleicht Schnappschüsse an gleichen Szenenlebenszykluspunkten.
  • Begrenzt Pools und verfolgt Referenzen, Ereignisse und asynchrone Arbeit.

Das könntest du fragen

Untersuche ein Unity-Spiel, das nach jedem Dungeon-Besuch mehr Speicher benötigt. Vergleiche Snapshots vor Eintritt und nach Verlassen und prüfe Texturen, Ereignisabonnements und Gegnerpools. Korrigiere gezielt die Lebensdauer und wiederhole mehrere Besuche: Der belegte Speicher soll stabil bleiben, ohne neue Allokationsspitzen im Kampf.

Ausführliche Dokumentation

Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.

Details…Weniger anzeigen

Memory Lifetime and Garbage Collection

Record Unity version, scripting backend, target memory budget and a representative load/play/unload sequence. Distinguish managed heap, native objects, texture/mesh/audio residency and reserved versus committed/resident memory.

  • Attribute allocation sites and collection spikes; GC.Alloc sample duration is not the full later collection cost. Avoid treating every allocation outside a hot path as a defect.
  • Compare memory snapshots at equivalent lifecycle points and inspect retainers/ownership. Repeated scene loads or pooled reuse should return to a justified steady state.
  • Keep pools bounded and reset references, callbacks and async work. Pooling can reduce churn while retaining too much memory; measure both effects.
  • Release resources through the APIs of their actual ownership system: Unity objects, NativeContainers, Addressables handles and external buffers have different contracts.
  • Investigate event subscriptions, static collections, async continuations and domain-reload-disabled state before forcing collections or unloading assets globally.
  • Use supported Memory Profiler and allocation tools and label Editor/player differences. Preserve serialized and gameplay state while changing lifetime.

Check repeated open/close, scene unload, death/respawn, pool growth and cancellation under representative load. Report bytes, ownership evidence and actual target conditions.

Reference: Unity memory management, using the installed Editor version.

Enthaltene Dateien 2

  • LICENSE.txt
  • SKILL.md