Hi i used to make some games some 4 years ago and i started to get back into it now, i am making a sort of RTS game where units move through tiles instead of a normal open map.
The issue i currently have is that each tile has a script witch has a list of adjacent tiles that units can reach from a given tile (this is an attempt to mimic road connections to those tiles) but i dont know a way to pass this script to the unit sitting on the tile once it moves to a new tile.
In essence i have Game object 1 (unit) with Script 1 ( unit movement script) that gets the information about its current tile passed to it from Script 2 (this is the tile handler script) when it is instantiated because the tile acts as a spawner so it has access to all of the data that i need to handle unit movement.
What i need is for Script 1 to see Script 3 (tile handler script for the tile the unit is moving to) and read its adjacent tiles list so it can move from this new tile
If anyone has an idea of how to do this i would be very thankful.
Another idea i had is to consolidate all of the tile connections into a single list that would act as a global manager but i am not exactly sure how i would implement that