I am doing a language changing system with buttons where if you click the language you want it changes to that language. I am doing this by using different arrays for each language and when I click one of them it assigns all of the main array string’s values to that language’s array values.
It works, however I am getting an array out of bounds for some reason. Can anyone point me in the right direction?
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Mainscript : MonoBehaviour {
public Text Test;
public string[] names;
public string[] Ptnames;
public string[] LanguageHolder;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
UpdateStrings();
}
public void changePt()
{
for(int i = 0; i <= Ptnames.Length;i++)
{
LanguageHolder _= Ptnames*;*_
}
}
public void changeEnglish()
{
for (int i = 0; i <= names.Length; i++)
{
LanguageHolder = names*;*
}
}
public void UpdateStrings()
{
Test.text = LanguageHolder[0];
}
}