// Start is called before the first frame update void Start() { //Bug generated when switching back to the map scene // should be solved getting the battleline model from the list instead of creating a new one here when the list is already populated if (!StaticResources.SwitchedScene) { this.battleline = new BattlelineModel(); StaticResources.Battlelines.Add(this.battleline); } }
// Start is called before the first frame update void Start() { this.battleline = StaticResources.CurrentBattleline; foreach (var deployment in this.battleline.Deployments) { foreach (var spot in GameObject.FindGameObjectsWithTag("Spot")) { if (deployment.SpotId.Equals(spot.GetComponent <SpotBehavior>().Id)) { GameObject spawnedobj = (GameObject)Resources.Load("Prefabs/Unit"); spawnedobj.transform.position = spot.transform.position; spawnedobj.GetComponent <UnitBehavior>().setModel(deployment.Unit); GameObject.Instantiate(spawnedobj); } } } }