Can anyone help with this? Very new to this, but no matter what variable I try to pass from one script to another I get the null alert of death... Even when successfully passing the method or variable through.
Are both scripts on the same object? Because if no, I believe you'll need a reference to ship's gameObject to search in it
You might have another gameobject with that enemy script on it that you forgot about. Put Debug.Log("random text", this); in the Enemy scripts Start method and see how many get logged, then click on the log in the console and it will show you the object in the scene.
You guys are awesome. For simplicity I just deleted my second game object “enemy ship” and made sure both scripts were on my only game object “ship”. This solved the error. I must have had the script attached to both ships. I found the solution to be create an empty game object as a communicator between the enemy and ship. Then I declared the two classes in the communicator. Then rather than use get.component I use the inspector and drag the ship and enemy into the declared variable classes on the communicator. It appears as though this gives me access to all the variables from the two classes in one script. Thanks fellas