pietrodito
pietrodito

Reputation: 2090

How to declare an icon to show in the editor dialog?

At the very first page of the reference manual of GDScript there is a learn GDscript in x minutes with a line of code which seems to be a macro @icon("path/to.png") but that does not work on the latest version of Godot (v 3.3.stable.mono.official):


@icon minimal example

class_name Player

extends KinematicBody2D

@icon("res://icon.png")

func _ready() -> void:
    pass

error

Parser Error: Parse error: Unexpected '@'

Upvotes: 1

Views: 911

Answers (1)

Theraot
Theraot

Reputation: 40220

You are reading documentation for Godot 4.0 (look in the url, you want "stable" not "latest"). See also GDScript progress report: New GDScript is now merged.

In Godot 3.x to specify an script icon you do it in the class_name statement, like this:

class_name Player, "res://icon.png"

See Register scripts as classes.

Upvotes: 2

Related Questions