Pass array of values from component to game instance?

Hi,
I am recording the positions of my AI character in arrays using a components. So each character will have an array with its positions stored in it. I would like to get these arrays in to my game instance. However I do not know how to pass variables from on script to another in unreal. Passing variables arrays etc. between different C++ scripts in unreal engine is like a nightmare for me.

In other words, how do I make a C++ script access an array in another C++ script?

Detailed reply with the relevant functions usage would be much appreciated.

Thanks in advance.

GameInstance is globally accessible, so what you need to do is to get access to your own game instance:

UMyGameInstance* MyGI = Cast<UMyGameInstance>(GetWorld()->GetGameInstance());

Use this code in your character to get game instance and after that you can simply get or set any data to it:

MyGI->GlobalArray = CharacterArray;