Inheritance error using C#
Asked Answered
M

1

0

So I have two classes one called Alien that extends from class Area3D and one called ShieldAlied that extends form the base Alien Script, however when I try to run my game, it crashes with error "Scripts inherits form native class 'Area3D', so it can't be assigned to an object of type: 'Node3D' ", which is very weird because the node I attached script to is an Area3D node. Anyone can help? I'm using c# and Godot 4.2

Mathildemathis answered 22/11, 2023 at 22:7 Comment(0)
O
0

Mathildemathis Each C# class needs to be in a separate source file whose name is exactly the same as class name, including case. So class Alien should go into Alien.cs and ShieldAlien into ShieldAlien.cs.

Orchidaceous answered 22/11, 2023 at 22:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.