- Home /
Question by
wolfgangmami · Sep 17, 2018 at 12:51 AM ·
c#logicprogramming-basics
How do I get component with one variable
Hi I'm getting component with this code
qualityslider = GameObject.Find("Canvas/Status_screen/Service_slider");
qualityslider1 = quality1.gameObject.GetComponent<Slider>();
qualityslider is gameobject type and qualityslider1 is slider type but this is very stupid I'm searching on Google but I'm not found anything is there any easy way like this
qualityslider = GameObject.Find("Canvas/Status_screen/Service_slider").gameobject.GetComponent<Slider>();
or something like that I would be thankful
Comment
Best Answer
Answer by Nikola7007 · Sep 17, 2018 at 02:18 AM
Does GameObject.Find("Canvas/Status_screen/Service_slider").GetComponent<Slider>();
work?
$$anonymous$$y mistake your code is working thx (I should take more sleep)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Initialising List array for use in a custom Editor 1 Answer
How to find Gameobject with given coordinates 1 Answer
Drill-like system 0 Answers