S
S
sindenlightogun2020-10-25 23:26:42
C++ / C#
sindenlightogun, 2020-10-25 23:26:42

How to access all GO components in Unity?

Cannot access all components attached to the camera.
The GetComponents method does not work, it asks me to write the type of the parameter, and when I do, it says
Error CS0104 'Component' is an ambiguous reference between 'UnityEngine.Component' and 'System.ComponentModel.Component'.

private Camera _camera;

    void Start()
    {
        _camera = GetComponent<Component>();
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-10-26
@sindenlightogun

So disambiguate, specify the full name, it tells you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question