mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Merge pull request #106243 from juanjp600/dotnet-script-initialization-order-collections-bug
Fix 'Script class can only be set together with base class name' error with .NET typed collections upon rebuild
This commit is contained in:
		
						commit
						26678d065f
					
				
					 1 changed files with 19 additions and 0 deletions
				
			
		|  | @ -840,6 +840,25 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { | |||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	// Add all script types to script bridge before reloading exports,
 | ||||
| 	// so typed collections can be reconstructed correctly regardless of script load order.
 | ||||
| 	for (Ref<CSharpScript> &scr : to_reload) { | ||||
| 		if (!scr->get_path().is_empty() && !scr->get_path().begins_with("csharp://")) { | ||||
| 			String script_path = scr->get_path(); | ||||
| 
 | ||||
| 			bool valid = GDMonoCache::managed_callbacks.ScriptManagerBridge_AddScriptBridge(scr.ptr(), &script_path); | ||||
| 
 | ||||
| 			if (valid) { | ||||
| 				scr->valid = true; | ||||
| 
 | ||||
| 				CSharpScript::update_script_class_info(scr); | ||||
| 
 | ||||
| 				// Ensure that the next call to CSharpScript::reload will refresh the exports
 | ||||
| 				scr->reload_invalidated = true; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	List<Ref<CSharpScript>> to_reload_state; | ||||
| 
 | ||||
| 	for (Ref<CSharpScript> &scr : to_reload) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thaddeus Crews
						Thaddeus Crews