Make sure "transform.position" and "this.HomeRegion()" don't evaluate to null. It's very likely one of them does so.
The difference between instanciating the red team and the blue team is the prefab/existing GameObject you're using for the instantiation. You could also try to instanciate the red team twice and see if there are any troubles.
By the way: you also may want to use
properties instead of your "Steering" and "HomeRegion" methods.
Also, please, indent your code. It would ease the reading. ;)
What I would do in a different way:
- Instead of searching for GameObjects ("GameObject.FindGameObjectWithTag([...])"), you could assign them (SendMessage("Set[...]", [...])) right after instanciating the GameObjects. This way you wouldn't need to check, wether it's the red or the blue team within the team script.
And regarding the team color: I would make it a variable of the script (of type of an enumeration of "all team colors" - red and blue). - Also if you're assigning the values this way, you could assign anything that differs between the red and the blue team, so you would only need to have a single "team" prefab.
- are the goals contained in the scene or are the goals contained in the teams hierarchy? In the latter case: create a variable in the team script and assign the goal, otherwise you should assign it the same way as you're assigning everything else.
But keep in mind: in my opinion this would lead to a better design, but on the one hand my opinion is not necessarily the best regarding good design, and on the other hand a good structure for the game
can help to keep order to the project, but it's not
required to finish the game.
Oh, and what I'm doing about the "GetComponent" calls: I just use them (almost) only for components of the exact same GameObject, and assign anything else to the variables using the inspector. (The exception to this rule could be, when I need different components of the same GameObject, like the teams goal script and the corresponding transform, but that's a very, very rare case though.)