handzlikchris / handzlikchris/FastScriptReload

Hot-reloading issue with specific child class of a generic class

Open
#192 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.2k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

When a class inherits from a generic class with itself as a type argument, FSR tries to hot reload but causes error due to the reference to original class name is missing.

For example, the class below will causes exception when modified inside play mode.
```
public partial class GameManager : MonoBehaviourSingleton
```
```
FSR: Error when updating files: 'GameManager.cs', FastScriptReload.Editor.Compilation.HotReloadCompilationException: Compiler failed to produce the assembly. Output: 'C:\Users\Nugget\AppData\Local\Temp\0fe7e28f1b734ebeb756f4db6ff4d726.SourceCodeCombined.cs(42,152): error CS0246: The type or namespace name 'GameManager' could not be found (are you missing a using directive or an assembly reference?)' ---> System.Exception: Compiler failed to produce the assembly. Output: 'C:\Users\Nugget\AppData\Local\Temp\0fe7e28f1b734ebeb756f4db6ff4d726.SourceCodeCombined.cs(42,152): error CS0246: The type or namespace name 'GameManager' could not be found (are you missing a using directive or an assembly reference?)'
```

Is it a known or unknown limitation, or a bug?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue in Unity play mode using a child class such as GameManager inheriting from MonoBehaviourSingleton, then inspect the generated combined source and hot-reload compilation output. The fix is complete when modifying the class reloads successfully without the CS0246 error for the self-referential type.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.