- Home /
 
               Question by 
               MaT227 · Jan 09, 2015 at 01:35 PM · 
                c#gameobjecteditoreditor-scriptingcomponent  
              
 
              How to add a component on a GameObject in Custom Inspector
How can I add a component on a GameObject in a Custom Inspector ?
Is it possible to place it at a defined place in the component hierarchy ? The best thing would be to place it above another known component.
Thanks !
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Paulius-Liekis · Jan 09, 2015 at 06:21 PM
in OnInspectorGUI function:
 (target as ScriptiptThatThisCustomInspectorIsFor).AddComponent<AnotherScript>();
I don't think you can define order of components.
Your answer
 
 
             Follow this Question
Related Questions
DestroyImmediate(component.gameObject) destroys component but not gameObject 1 Answer
How to access Custom Inspector own gameObject 1 Answer
Execute Code When Component Added 6 Answers
Custom Editor Script resets values on Play 1 Answer
Disabling A Script on a GameObject From a Different Script 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                