'How to reference a component of another GameObject in inspector window?
The component needs to be referenced in an array.But if I directly drag the GameObject in the variable field, the default component is Transform. In the picture below, the component I want to assign is Skinned Mesh Renderer, instead of Transform.enter image description here
Solution 1:[1]
if you use:
[SerializeField] private List<Component> components;
you can fill the components via drag & drop.
An easy way is:
- lock the inspector (upper right corner)
- open a second inspector-window (via "add tab")
- drag & drop the components
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rbcode |
