Skip to content

Custom properties component

Zsuró Tibor edited this page Jul 14, 2023 · 3 revisions

What is custom properties component?

Here you can store key-value pairs what you can get in runtime.

Usage in Editor

You should select CUSTOM_PROPERTIES value in dropdown and click to Add component button.

image

After this the custom properties component added to the game object and visible in the Inspector.

image

You can add key-value pairs and remove them with the X button.

image

Usage in runtime

GameObject go = getYourGameObject();
CustomPropertiesComponent component = (CustomPropertiesComponent) go.findComponentByType(Component.Type.CUSTOM_PROPERTIES);
String hp = component.get("hp");
Gdx.app.log("", "HP: " + hp);