RequireComponent not adding in components
When I use the RequireComponent piece, it doesn't seem to actually add the component I'm referencing as well when adding in the specified component:
[RequireComponent (typeof(Rigidbody))]
public class KeyboardTracker : DeviceTracker
{
In the above, when adding a KeyboardTracker to a GameObject, it doesn't add the Rigidbody like it's supposed to (I am using the rigidbody to test the functionality, as it wasn't adding my own class either).
I've seen a lot of threads saying to remove it and re-add it as adding in the RequireComponent part after the script was already added won't make it add the required component due to when it adds the required component, but I have attempted that several times, even going so far as to create other classes and the like, and it just doesn't seem to want to work.
Answer by CheckovZA · Sep 17, 2017 at 04:42 PM
Ok, a reload of unity seems to have fixed the problem. Not sure what happened, but I'll keep this here in case anyone else might get some use out of it.