egametang/ET · error · Exception

not found scene type: {type} {sceneName}

Error message

not found scene type: {type} {sceneName}

What it means

Thrown by SceneTypeSingleton.GetSceneType when the scene name is unknown. The singleton maps scene names to integer codes (built from enums at startup); a name that resolves to 0 means it was never registered, which is treated as a misconfiguration.

Source

Thrown at Packages/cn.etetet.core/Scripts/Core/Share/Entity/SceneTypeSingleton.cs:43

            return false;
        }
        
        public void Awake(Type type)
        {
            Init(type);
        }
		
        public string GetSceneName(int sceneType)
        {
            return this.GetStringByValue(sceneType);
        }
		
        public int GetSceneType(string sceneName)
        {
            int type = this.GetValueByName(sceneName);
            if (type == 0)
            {
                throw new Exception($"not found scene type: {type} {sceneName}");
            }
            return type;
        }

        public Dictionary<int, string> GetAll()
        {
            return this.enumValueString.GetAll();
        }
    }
}

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Use the exact registered scene name (match the codegen enum), and regenerate scene-type codegen after renames.
  2. Ensure SceneTypeSingleton is initialized before GetSceneType is called.
  3. Validate the name exists via GetAll() during development to catch typos.

Example fix

// before
int st = SceneTypeSingleton.Instance.GetSceneType("MapScne");   // typo

// after
int st = SceneTypeSingleton.Instance.GetSceneType("MapScene");
Defensive patterns

Strategy: validation

Validate before calling

var all = SceneTypeSingleton.Instance.GetAll();
if (all.ContainsValue(sceneName))
{
    int st = SceneTypeSingleton.Instance.GetSceneType(sceneName);
}

Prevention

When it happens

Trigger: Calling GetSceneType with a scene name not present in the registered enum set; typo in a scene name string; scene type enum regen/registration not run; querying before the singleton is populated.

Common situations: Renaming a scene without regenerating the enum codegen; passing a localized/aliased name instead of the registered enum name; querying scene type during bootstrap before codegen data loads.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/91469770ef11511c. Report an issue: GitHub.