I’m not sure why it’s doing this, but I currently have a script that only has this:
// Use this for initialization
void Start ()
{
gameObject.AddComponent("TestStraightShooter");
}
The script that I’m adding has a prefab component to it that’s assigned in the inspector.
Like so…
However when I run the game, the script gets added to the game object, but the Prefab on the script isn’t set to anything.
Like so…
If I just drag the script in, the prefab is there, but if I try doing it via code, it doesn’t show up.
I’m doing this because in my game, you’ll be able to purchase different weapons which are just going to be scripts added to the player game object.