This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I've created a custom Class inheriting from a resource.

How can I redefine the value a certain inherited property starts out with?
Better yet, how can I override the default of a property exported by the superclass?

I tried the following approaches:

@export property_name = 64
# Unexpected "Identifier" in class body.

@export var property_name = 64
# Member "property_name" redefined (original in native class 'TileSet')

@tool
class_name CustomTileSet
extends TileSet
func _init():
    if Engine.is_editor_hint():
        property_name = 64
# Does indeed set the value, but not the default (and might cause other problems)

set_meta("property_name", 64)
# modifies the wrong kind of metadata (Object Metadata instead of class member metadata)
Godot version 4.0 rc 1
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.