- Home /
Unity scripting - Script one can't find script2 via getComponent but script2 can
Hi! So my title pretty much says it when i try to access script2 from script1 via variable.GetComponent<Script2>()
it show it like it's not declared but when I try to call script1 from script2 it's working as intended! I got no idea from what it could be I tried to reset my solution explorer in my visual studio! I tried with monobehaviour but script1 couldn't see script2 f or some reason!
Answer by bajtek · Dec 21, 2017 at 12:26 PM
Maybe script2 is not a public?
Script2 is public and script1 too! The things is that this error is not that obvious it's something from the solution explorer but since I have nothing to zero knowledge on visual studio besides the fact of coding I asked here! The scripts are both in one folder too! And if it makes it easier the scripts are FirstPersonController and simple pause menu!
Your answer
![](https://koobas.hobune.stream/wayback/20220612144957im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Keeping the int value "min" to be used in another scene. 2 Answers
Script not checking if a different script is active. 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers