- Home /
Question by
Orolo · Feb 03, 2014 at 12:31 PM ·
inspectortexture2daddcomponentpublic variable
Variables assigned in the inspector of a script don't seem to work when instantiating them via AddComponent
that's my little test script. when i attach it to a game-object manually, test2 is not null, but when i attach it using AddComponent, it is. is there a way to get that to work?
alternatively, i could move the texture into the resources folder and load it based on a string, but that would make setting the icon for each of my items a bit more work. ;) is there a better alternative?
another question: why do test and test3 in that script not show up in the inspector? they both show up in the inspector when the script is attached to a game-object:
Comment