Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set custom property to Phaser game object #304

Closed
JernejHabjan opened this issue Dec 25, 2023 · 7 comments
Closed

Set custom property to Phaser game object #304

JernejHabjan opened this issue Dec 25, 2023 · 7 comments

Comments

@JernejHabjan
Copy link

image

This image gameobject also has z coordinate, that I'd like to set in the editor, but it's not exposed in the inspector panel. Allow setting any custom property like for prefabs also to game objects like image, sprite

@PhaserEditor2D
Copy link
Owner

Hi, you can create a user component with additional user properties and add it to any game object in the scene.

https://help-v3.phasereditor2d.com/scene-editor/user-components.html#

@JernejHabjan
Copy link
Author

@PhaserEditor2D creating custom component is not what i want, because I want to specify numeric value (0-255) for z axis, which differs from sprite to sprite.
As all gameObjects have this property already, id just want to see it in Phaser editor.

@PhaserEditor2D
Copy link
Owner

Hi @JernejHabjan

So you don't need a custom/user property, what you need is to add the Z property to the editor. It means, a new feature in the editor.

@JernejHabjan
Copy link
Author

@PhaserEditor2D that's right. But I presume that most users won't need to see Z property in the panel. Could we have a button to "add" a property and it's value?

@PhaserEditor2D
Copy link
Owner

Could we have a button to "add" a property and it's value?

Mmm... I don't know I have to think more about it. We have a button to add a user component :)

Btw, why do you need the Z property? What kind of stuff you are making? Maybe it is part of a bigger feature that I plan to implement.

@JernejHabjan
Copy link
Author

I'd like to use Z axis to specify at which height the block / sprite is placed in isometric world, as I'd like to create multi-height isometric world.

image

currently I'm writing this Z in custom prefab exposed property, but ideally I'd like to set it to Gameobject.Image as it's just terrain

@PhaserEditor2D
Copy link
Owner

Oh yes, I have to do more about isometrics. Like a sorting layer. It will help in the case of isometrics and also other kind of worlds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants