- Home /
Question by
$$anonymous$$ · Aug 30, 2014 at 03:27 AM ·
typesrequirecomponent
RequiredComponent with Custom Types
Can I require a component of a custom type somehow? Or is it only possible for Unity types?
Comment
Best Answer
Answer by Kiwasi · Aug 30, 2014 at 04:30 AM
You can require any type of component. The code is exactly the same. In c#
[RequireComponent(TypeOf(MyMonoBehaviour))]
Oh. I tried that. I must just not understand how RequireComponent works yet. (I have read the documentation.) I'll keep at it. Thanks!
Your answer
Follow this Question
Related Questions
Get types from UnityEngine.dll failed on RequireComponent 1 Answer
How to set the property of my required component? 2 Answers
cannot convert UnityEngine.Gameobject to GameObject - What's the difference? 1 Answer
How does RequireComponent expose properties 1 Answer
InvalidCastException with .net datatypes but not with UnityEngine.Object 1 Answer