Good way to create different (static) IDs for different nodes that call from the same script?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By eLTeh

For context: I’m trying to code location pointers for entrances/exits, as well as dialogue information. Right now, I could probably hard-code it, but I foresee the project growing, so I’d rather store all my information in tables and call it right from the code. It would also be much easier to edit.

The implementation I have in mind is converting a .csv to a .json through code, with the .json properly formatted and ready to be called by the script. The .csv would also be formatted similarly to the tables in this article: The code behind localizing Japanese games

The thing is, I’m not quite sure how I should assign a unique ID (one that never changes!) for each object. For now, my placeholder is assigning a static “id” variable in the script, but that’s not going to be possible when multiple nodes use the same script.

Could anyone point me in the right direction? Thanks.

i assume you are talking about static nodes in the scene. what about the “NodePath”?

nah | 2021-11-15 07:33