K
K
Kifoter2020-07-06 20:00:51
Unity
Kifoter, 2020-07-06 20:00:51

How does the code from the book work?

I use the book "Unity in action" and I write this code in a script:
5f0356fff3a10985812590.png"
and it underlines the error:
5f0357a03c12a109989360.png
5f0358117a95d189964667.png
tell me how they differ and if they don't differ why?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
GavriKos, 2020-07-06
@GavriKos

Open the unit manual and read how GetComponent works. Or turn on your brain and think - WHAT component should the method return to you

F
fronttrty, 2020-07-06
@fronttrty

the person above, wanted to say that in GetComponent () <> in <> you need to specify a specific component.

Y
yuopi, 2020-07-07
@yuopi

GetComponent(typeof(_camera));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question