- Home /
instantiate gameobject in editor
hello, is there any way to access several monobehaviour scripts, from an editor?
I am learning and looking for information, I want to access 3 scripts from editor, but I can only access one, using "customeditor" try to use "requirecomponent (typeof), but it did not work. any ideas? Thank you!
Answer by ismaelflorit · May 06, 2019 at 04:58 AM
Not 100% this is what you're looking for, but perhaps it helps. Accessing other scripts from same gameobject:
gameObject.GetComponent<YourScriptName>();
And to access methods/variables:
gameObject.GetComponent<YourScriptName>().someMethod();
And to access scripts from other gameobjects, set the appropriate scopes in variables or search for them by tags. This post explains it well.
Hope that helps!
Your answer
![](https://koobas.hobune.stream/wayback/20220612200803im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Making a static class derive from MonoBehaviour in C# 3 Answers
Accessing a game script from an editor script. C# 0 Answers
Generic CustomEditor 1 Answer