Hey guys, correct me if I’m wrong, but the RequireComponent is suppose to add the required component at runtime right?
Here is my script
I’ve done this in the past and it worked, but I just recently upgraded to 5.3, and it doesn’t seem to be adding the Rigidbody2D component. I compare the codes to my previous one and it seem just about right, am I missing something else?
@Positive7 @Chng Ugh this solved it for me too, which made me realise what the documentation for RequireComponent means with this:
“Note that RequireComponent only checks for missing dependencies during the moment the component is added to a GameObject. Existing instances of the component whose GameObject lacks the new dependencies will not have those dependencies automatically added.”
Simply Saying, Create The script separately in the project window, after Completing the script, add it to the GameObject then it works