-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
createFromObjects()
doesn't copy custom properties
#6391
Comments
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
@photonstorm I guess the currently documented behavior is changing, then? Per new docs, "Custom object properties that do not exist as a Game Object property are set in the Game Objects data." That said, an option to automatically update gameobject properties based on custom properties sounds great. |
The correct behavior should be the same in v3.55 and v3.60. The incorrect behavior was in the some of the v3.60 betas only. If you create a sprite from Tiled Object
then the resulting sprite will have
Here |
Thanks for underscoring that, @samme . I definitely misread it. That said, I cannot get custom properties to have any effect. In my case, I'm creating game objects from a class that extends this.tileMap.createFromObjects("GameObjects/Ships", {
name: "SimpleShip",
scene: this,
key: "ship",
classType: SimpleShip,
}) The corresponding "SimpleShip" entry in Tiled on the Tiled layer "GameObjects/Ships" is defined like this: This works great, except for the custom properties issue. Only "alpha" and "color" show up. Alpha shouldn't even be there, if I understand you correctly. "dummy" should be there, but it's not.
For completeness, I tried again without a custom class (I added to the aforementioned Tiled Layer an object named "LOL"). const LOL = this.tileMap.createFromObjects("GameObjects/Ships", {
name: "LOL",
scene: this
}) For the "LOL" object, all of the custom properties do show in the data store, including the ones that shouldn't (like alpha and scale). Do you think there's an issue with my code, or perhaps there's a bug? Thank you Edit: i should add, I'm issuing the regular release of 3.60 |
This is definitely in Phaser v3.60.0, not a beta? I can't think of why that would happen. In tilemap/create from objects |
Check the browser Dev Tools. Phaser logs its version number to the console when it boots. For example, you may have npm at 3.60 but override it with a different package / script tag. Worth checking. |
Hmm, I'm still getting unexpected results. I created a gist that will hopefully help anyone else reproduce what I'm seeing. 🤞 https://gist.github.com/paxperscientiam/c6a443d5315f2ce7b7e843c40353e073 |
@paxperscientiam I reproduced your problem. @photonstorm could you reopen? |
Thanks @samme |
Version
Description
This happened in v3.55.2 but it doesn't happen now.
Example Test Code
https://labs.phaser.io/edit.html?src=src/3.60\tilemap\create%20from%20objects.js&v=3.60.0-beta.18
The text was updated successfully, but these errors were encountered: