Execute Always in Coordinate Labeler Script

Was trying to make an empty game object to hold all my tiles and realized I couldn’t change the names of anything. I figured out that the execute always part of the coordinate labeler script was the culprit, is there another way to achieve the same results without using execute always?

Hi Satotz,

Welcome to our community! :slight_smile:

What is “the same results”? What is supposed to happen?

Hi Nina, the coordinate labeler script updates the names of tiles based on the there position. This happens in the editor as well. For some reason having [execute always] in the script enabled causes me to be unable to rename anything in my hierarchy. Once [execute always] is commented out in my script, I am able to rename things again. Is there something I am missing that could cause this?

[ExecuteAlways] triggers the Update method whenever something changes in the scene. If you rename one of your labels, the Update method gets executed, and the name gets overridden. This is supposed to happen with the game objects that have got the coordinate labeler script attached.

If only the names of the “label” game objects get overridden, you are experiencing what Gary intended to implement. If you cannot rename other game objects, check of those other game objects have got the CoordinateLabeler script attached and remove that component. If they don’t have it attached, you might be experiencing a bug in Unity. Updating Unity might be a good idea in that case.

Maybe it was just a bug in Unity, but I seemed to have found a fix. I added a “Tile” tag to my tile prefab and have UpdateObjectName checking for a tag, and it seemed to fix it. It’s weird because it wasn’t changing the names of anything else, it just wouldn’t let me rename any gameobjects in my hierarchy. Anyway thanks for taking the time to help.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms