I am creating a player controlled object which has a script in its prefab that will highlight the tiles that are valid moves. Script works fine if triggered manually but fails to do so in code
public GameObject player_prefab;
Start(){
GameObject playerUnit = GameObject.Instantiate(player_prefab,PlayerPoss,player_prefab.transform.rotation);
squadEvents squadScript = (squadEvents)playerUnit.GetComponent(typeof(squadEvents));
squadScript.ShowWalkRange();}
Digging around on the internet tells me my problem is the fact I am trying to access the script during start , but I can't find a reason why or come up with a work around, Thanks for any help with these issues