- Home /
Quick question about GetComponentsInChildren< MonoBehaviour >()
Hi,
I was wondering what the line:
MonoBehaviour[] behaviours = myObject.GetComponentsInChildren<MonoBehaviour>();
actually does. I have a feeling that it returns all of the components attached to myObject and places them into the behaviours array?
I could be way off the mark though.
Answer by MountDoomTeam · Oct 15, 2012 at 09:27 PM
it returns an array of the compoenent type specified. see componenet types.
DO u look at reference before asking?
http://docs.unity3d.com/Documentation/ScriptReference/Component.GetComponentsInChildren.html
I think you're under the impression that I was asking about GetComponentsInChildren<>() in general. The title seemed to be truncated and should have read:
'Quick question/confirmation about GetComponentsInChildren< $$anonymous$$onobehaviour >()'
As the majority of scripts in C# seem to derive from the base class $$anonymous$$onoBehaviour, this isn't a conventional component and so thus the question.
Your answer
Follow this Question
Related Questions
Which Monobehaviour messages get called in the inspector (scene not playing)? 0 Answers
Assigning Serializable child class, not visible in Editor 1 Answer
Disable all scripts on gameobject excluding the one calling for disable 2 Answers
Instantiating a prefab at runtime (without using Monobehaviour or Resources folder) 1 Answer
How to call invoke from a monobehaviour class using a function from an object class. 1 Answer