void Start() { //Define UsableWeapons link: gameController = GameObject.FindGameObjectWithTag (Tags.gameController); usableWeapons = gameController.GetComponent<UsableWeapons> (); playerInfoPanel = GameObject.FindGameObjectWithTag(Tags.canvas).GetComponentInChildren<PlayerInfoPanel> (); persistentData = GameObject.FindGameObjectWithTag (Tags.mainCamera).GetComponent<PersistentData> (); if(persistentData.primaryWeapon != ""){ EquipPrimaryWeapon(persistentData.primaryWeapon, persistentData.primaryWeaponAmmoCount, false); } else{ if(onStartWeaponName != ""){ //Determine index of onStartWeaponName primaryWeaponIndex = usableWeapons.primaryUsableWeapons.IndexOf(onStartWeaponName); Transform pickupob = Instantiate (usableWeapons.equippedPrimaryUsableWeapons[primaryWeaponIndex], primarySpawnpoint.position, primarySpawnpoint.rotation) as Transform; pickupob.parent = transform; primaryEquipped = pickupob; hasPrimaryWeap = true; playerInfoPanel.UpdatePrimaryWeaponInfo(); } else{ Debug.Log ("ERROR: Need to set onStartWeaponName."); } } if(persistentData.secondaryWeapon != ""){ EquipSecondaryWeapon(persistentData.secondaryWeapon, persistentData.secondaryWeaponAmmoCount, false); } }