In one script I have a class that holds a string and an int for displaying and asocating with a highscore
using UnityEngine;
using System.Collections;
public class Highscore : MonoBehaviour
{
string name;
int points;
}
In another script I want to access this information and keep it in an array, so I can add new highscores (modify values and shift scores around for sorting and remove lowest score)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class HighScoreGUI : MonoBehaviour
{
Highscore highScore = new Highscore[10];
highScore[0].name = "bob"; //errors are here
}
When I try to set a value for the first highScore I get error:
CS0178: Invalid rank specifier: expected ,' or ]’
and also error:
CS1519: Unexpected symbol `.’ in class, struct, or interface member declaration
Thanks for helping!
Thank you, I couldn't have received a more complete answer than this
– churf