Sunday, December 6, 2015

To many in Unity Tags List

This Image shows one of my new scenes, Field Farm, with the new baby cow etc. This is the view form the Scene in the Editor, so the objects in the scene are not currently scaled for the pseudo 3D look. That is all done at runtime in some code.

What this picture also shows on the right is the Unity Tags list. This can be very useful for naming objects and allowing you to test that name in the game for various effects. Now of course they won't be fast as it will be string comparisons.... but I digress.

Since I started using Unity I have tended to use the Tags for all sorts of naming tasks. One of those tasks was to name my 'Doorways' from one Scene to another. Names such as 'Door2NexusFrom Village' is one example. But as the game has gotten bigger and bigger and I have added more and more scenes (currently at 21), I have found that I have created approximately 40 Tags. I will be honest and say that this was bad. In fact I do not recommend this course at all. Experience now tells me that Tags should be used for multiple Objects that could be named differently, but use similar properties or some such.

Having 40 tags showed up a weakness in the Editor as well. Once you go over a certain number of them you have to scroll (clicking a small downward arrow) to get to the next one and so on. There is no hold and see them flash by, nope, you have to click al the way to the one you want. I have now removed the Doorway names from the Tags as the Image above shows. Instead I have simply named my Doors with the old tagged name. This works great and actually removed a step for me to get the doors to work in the game.

So when using tags, be aware what you want them for because if you end up with a large number of them, it is Very likely there is a simpler more easily handled way to do it.

G'night
Da Voodoochief

No comments:

Post a Comment