- Home /
Inspector:Reference a component in Assets, not in scene.
The same way it's possible to reference a gameobject prefab instead of a gameobject instance, is it possible to reference a component in the project assets instead of an instantiated component in the scene?
I want to drag a component script into a public variable in the inspector.
If it is possible, how? And if not, is there any other way to put a type into a variable through the inspector? I'd rather not use strings nor instantiated components for various reasons.
$$anonymous$$y RPG has items in the form of components. I create a character in the scene, I can't just attach item components to give that character items, since equipping items needs special equip logic. So i have an EquipItems component that I want to attach to the character that I can drag item components into. Then, EquipItems will create and attach those components and call necessary equip logic.
I have alternatives to doing it the way I specified in the original post, but doing it that way would be ideal.
Your answer
Follow this Question
Related Questions
Reference to Scene Object Component in Prefab Editor, 'Type Mismatch'? 1 Answer
Disable an unknown type of component at Runtime 2 Answers
.getComponent() creates an Instance? 1 Answer
Component passing self to method 1 Answer
Changing properties of component without Inspector using C Sharp 3 Answers