It instantiates the object fine, but when it gets to the addforce line, it says bullet is actually NULL. Despite it being instantiated fine, anyone have any insight?
you’re mixing up the types, what you have would work if _bullet was declared at the top as a Rigidbody, if you need to keep it as a gameobject you can’t cast the instantiated gameobject into a rigidbody, you need to use GetComponent
you also probably don’t want them as private fields since you cannot set them to anything in the inspector, unless they are being inititalised to something in code elsewhere
Serialized fields allow you to set them in inspector, without having them publicly accessed elsewhere!
I managed to do basically what you said as well, with the getcomponent and it is working fine! I realized it almost exactly after I posted the question!
Generally avoid as in casting unless you are going to do a null check immediately after. If you know the type, explicit casting is better. Or better still use the generic version of Instantiate.