Go.property why cant set string value

so why cant use string value? :face_with_raised_eyebrow: :face_with_raised_eyebrow:

Because it is :slight_smile:
It seems you can use a hash string

1 Like

Feature request:

3 Likes

It impacts performance so they don’t want to give you the option to be dumb with it. It’s one of those situations where they are doing it for your own good.

I understand you’re simply pointing out a fact, so my input here is not meant as a rebuttal against you.

The go.property feature supports a laundry list of types. The missing string type is such an obvious and highly desired feature that it makes sense to allow it, despite the potential for poor design for performance. Lots of Defold features have the potential to show poor performance if abused, as is the case in any game engine. This feature would help more developers than it hurts.

One simple solution for this would be to note on the documentation (linked above) that using string properties is not recommended and hash properties are preferred. Of course, that’s only if there’s a legitimate performance reason for not allowing strings, such as a potentially very large shallow copy.

1 Like

I completely agree. Better documentation that covers performance on all the api s would be a welcome improvement

1 Like

It seems a hash can be converted to a string, just drop the “[” and “]” and we have the string

But you can’t undo a hash to reformat it.

You can do on the string and then hash it :smiley:

As far as I know, I think we are more or less aligned on adding this feature to the property system, but I don’t know when we will have the time. There’s more caveats to introduce it than you’d think.

2 Likes

This will not work in a release mode. There is no reverse hashing in release, the decorated string is a development feature only so I wouldn’t rely on this

1 Like

Yes, we’ve reached a consensus that we will add it. We just need to find a slot in our development schedule.

3 Likes

You can use custom data component to store any type of data. Here is an example how to implement custom data component GitHub - defold/extension-simpledata: Example how to bring custom data to a game object.
After implementation you can add custom data component to any game object and get data from it via go.get("url_of_component", "field_name")
Also if you use custom data component you don’t waste script component counter to bake some data inside your game object.

4 Likes