#Setting the value of a Metadata Dictionary
14 messages · Page 1 of 1 (latest)
Is there a specific reason you're using metadata for this purpose? I haven't really seen it used before and based on the screenshot I'm not sure if this is a good usecase.
basically it adjusts the properties the bowling ball can have, it can have multiple which is why I decided to make it a dictionary
ahh i see~ might be better to use a variable in the script for it rather than the metadata eg:
@export var test : Dictionary
and then you get the same ui to change the values in the editor but can access it much easier:
- get:
test.get("Bouncy")ortest["Bouncy"] - set:
test["Bouncy"] = true
alrighty then, thank you!
acutally one more question. I decided an array is better suited for this. is there a way I can use an enum or something to give each of the numbers a name or no?
Don’t think so, afaik that’s (one) of the main reasons to use a dictionary (it’s also 100x faster)
This makes me wonder if a bitmask would be applicable
? I'm fairly sure dictionaries aren't faster than arrays like that
I know they have faster lookup, but not that much insanely faster
Actually, arrays seem to sometimes beat out dictionaries at lookup even
Being a high level language, the differences between data types are much less of an issue. Focus on using what works.
In Godot, class members can be exported. This means their value gets saved along with the resource (such as the scene) they're attached to. They will also be available for editing in the property e...