Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | JustHallowed |
Edit:
Current workaround from Inner classes are not recognized as type in extended classes. · Issue #69050 · godotengine/godot · GitHub until it gets patched. Append a ParentClass
extends "res://Scripts/Parent.gd"
const Parent = preload("res://Scripts/Parent.gd")
func Init(_inventory:Parent.InventoryBase):
// Do something
...
Original question:
Important note: This error only appeared when I migrated my project from v3.5 stable to v4.0 beta 5
I get the following error in my code in my child class
Parse Error: “InventoryBase” was not found in the current scope.
Parent class (InventoryDisplay.gd):
extends Node
const InventoryBase = preload("res://Scripts/InventoryBase.gd")
...
Child class (InventoryDisplay_Player.gd):
extends "res://Scripts/InventoryDisplay.gd"
func Init(_inventory:InventoryBase):
m_Inventory = _inventory
...
-
InventoryBase is just a script that extends the Object type in Godot.
-
I have no issue in my parent class and when I try to define
const InventoryBase = preload(“res://Scripts/InventoryBase.gd”)
in my child class it shows this error instead
The member "InventoryBase" already exists in a parent class.
I’m not sure if I am missing anything, please advice.