Attaching variables or constants to objects

I am aware Unity has a tag and layer system, however it doesn’t quite meet the needs for projects I have planned, and I have other uses for those already. It would be much easier for me if I were able to attach variables to an object. For example, I’d like to attach an integer, long or float to a game object directly.

I’ve done this before using scripts, however I am unaware of the memory consumption of that as it seems unnecessary to attach an entire script to hold what’s, essentially, one line of code.

Much like how scripts or aspects (e.g. transform) are attached to game objects directly, is there any way I could attach a variable directly like this without using a script?

Alternatively, if there is no alternative, how significant is the memory cost of attaching a simple script without functions? Would I expect a drop off as I approach hundreds, thousands or how many instances of a simple script holding an int or a long?

I think you’re doing it wrong. It would be better to have your one main controller script keep track of all the objects and their associated values in a dictionary that you add objects to when they are created, and remove from when they are deleted.