GodotSharp.SourceGenerators icon indicating copy to clipboard operation
GodotSharp.SourceGenerators copied to clipboard

[OnInstantiate] does not search all project scene files

Open valkyrienyanko opened this issue 5 months ago • 6 comments

My project is setup so scripts are separate from scene files

I have always organized my project by having a res://Scenes folder for all .tscn files and a res://Scripts folder for all .cs files. I'm not sure how I feel about keeping the .tscn files next to the .cs files. I might just refactor my entire projects file structure just to use this attribute.

The Issue

I get the following error when I try to use [OnInstantiate] in UIOptions.cs. This is because there is no UIOptions.tscn file in this path as its located under res://Scenes not res://Scripts.

Error: Cannot open file 'res://Template/Scripts/UI/Options/UIOptions.tscn'.

Actual Scene Path: res://Scenes/Prefabs/UI/options.tscn Actual Script Path: res://Template/Scripts/UI/Options/UIOptions.cs

valkyrienyanko avatar Sep 22 '24 16:09 valkyrienyanko