Hello. I have a prefab “AK47”. Its structure looks like this:
On the top-level of that prefab, I have a “Weapon” script. Here is how the AK47 weapon script is configured. Note the “Muzzle Flash Mount” is null, and the “Muzzle Flash” is a reference to another Prefab within my project.
When I run the game and create an AK47 unit, I can see in the inspector that it has mounted properly (note that it is a child of “Weapon Mount,” something that all of my unit prefabs have in common, so that they can all use every weapon.
Further investigation reveals that the “Muzzle Flash Mount” variable within the Weapon script, which was originally null, is no longer null. In fact, it points exactly to the Muzzle Flash Mount that it should!
But, for SOME REASON, the Weapon script keeps printing out that it is NULL when it’s called upon! (It was printing “null” in the console when I took the above photo)
I’m so frustrated, please help! It seems like it should be very simple.
The Weapon script can be found in this pastebin