godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.79k stars 20.13k forks source link

Parse Error when defining function called "set_zoom" on Camera2D #95726

Closed alanmelloni97 closed 3 weeks ago

alanmelloni97 commented 3 weeks ago

Tested versions

System information

Windows 11

Issue description

when defining a function called "set_zoom" on a Camera2D the following errors appear:

_res://aaaa.gd:4 - Parse Error: The function signature doesn't match the parent. Parent signature is "set_zoom(Vector2) -> void". res://aaaa.gd:4 - Parse Error: The method "setzoom()" overrides a method from native class "Camera2D". This won't be called by the engine and may not work as expected. (Warning treated as error.)

despite class Camera2D having no such function. This function existed on Camera2D only on Godot 2.1. This doesn't happen on Camera3D.

Steps to reproduce

Add a script to a Camera2d with this code:

extends Camera2D

func set_zoom():
    pass

Minimal reproduction project (MRP)

N/A

Chaosus commented 3 weeks ago

zoom is a property of Camera2D and as a property it has two accessors which are set_zoom and get_zoom:

изображение

alanmelloni97 commented 3 weeks ago

sorry, my bad