Here's the scenario: I've got two scripts, on separate Game Objects, that need to access each other information. The first script needs to send an array to the second. The second then needs to remove an object from that array.
I've mocked up what I'm trying to achieve below.
At the moment I'm getting a few different errors... but I just can't figure out what the fixes to these issues are. Where am I going wrong?
First of all you cannot access variables that are declared inside other functions. You can use
to access the foo variable from fooscript. The only thing you need to do now is set the fooGO and barGO referenced gameobjects in the inspector. Just remember that you can only access non-private variables that are declared outside of any function.