Unity3d 乐谱未显示在吉他文本中
我有一个名为scoreLevel1,scoreLevel2的吉他文本,我想显示正确级别的分数,但它没有显示任何文本或分数。。。没有生成错误。我怎样才能让它像预期的那样出现Unity3d 乐谱未显示在吉他文本中,unity3d,unityscript,Unity3d,Unityscript,我有一个名为scoreLevel1,scoreLevel2的吉他文本,我想显示正确级别的分数,但它没有显示任何文本或分数。。。没有生成错误。我怎样才能让它像预期的那样出现 var Score : int; function Update () { Score -= 1 * Time.deltaTime; guiText.text = "Score: "+Score; TimerOfDeath(); } HighScores.js: GetHighScores.js:
var Score : int;
function Update () {
Score -= 1 * Time.deltaTime;
guiText.text = "Score: "+Score;
TimerOfDeath();
}
HighScores.js:
GetHighScores.js:
问题是分数计算不正确还是吉他文本没有在任何地方呈现?在GetHighScores.js中,您有一个错误:whilehscount<5&&->iterations>MaxIterations我有一个名为scoreLevel1,2,3,4,5的吉他文本。例如,在scoreLevel1中,我想显示玩家在级别1中得到的分数。vsenik i将iterations>maxIterations更改为iterations
//run at start if score doesn't exist yet to initialise playerPref
function Start(){
if(!PlayerPrefs.HasKey(Application.loadedLevelName+"HighScore"))
PlayerPrefs.SetFloat(Application.loadedLevelName+"HighScore", 0);
}
//run when level is completed
function OnTriggerEnter(other : Collider){
if(other.tag == "Player"){
Score = gameObject.Find("ScoreCount").GetComponent("ScoringPts").Update("Score");
if(Score > PlayerPrefs.GetFloat(Application.loadedLevelName+"HighScore"))
{
PlayerPrefs.SetFloat(Application.loadedLevelName+"HighScore", Score);
}
}
}
#pragma strict
function Start () {
var hscount = 1;
var iterations = 1;
var maxIterations = 5;
var findtext = gameObject.Find("scoreLevel"+(hscount));
while(hscount < 5 && iterations < maxIterations){
if(!PlayerPrefs.HasKey("Level"+(hscount)+"HighScore")){
findtext.guiText.text = "Level"+(hscount)+ ": " + PlayerPrefs.GetFloat("Level"+(hscount)+"HighScore");
hscount++;
}
iterations++;
}
}