커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
패널이 보이지 않습니다
undefined주차
북마크
박*현
댓글
4
추천
0
조회수
15
조회수
15
답변 완료

게임오버 기능까지 구현하고 점수 동기화로 넘어왔습니다.

점수동기화 코드까지 입력했는데 실행하니 점수동기화도 이루어지지 않고 패널 배경이 사라집니다.


스파르타 즉문즉답




using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.UI;


public class gameManager : MonoBehaviour


{

    public GameObject square;

    public Text timeTxt;

    public GameObject endPanel;

    public Text thisScoreTxt;

    public static gameManager I;


    float alive = 0f;

   

    // Start is called before the first frame update

    void Start()

    {

        InvokeRepeating("makeSquare", 0.0f, 0.5f);

    }


    // Update is called once per frame

    void Update()

    {

        alive += Time.deltaTime;

        timeTxt.text = alive.ToString("N2");

    }

    void makeSquare()

    {

        Instantiate(square);

    }

    void Awake()

    {

        I = this;

    }

    public void gameOver()

    {

        Time.timeScale = 0.0f;

        endPanel.SetActive(true);

        thisScoreTxt.text = alive.ToString("N2");

    }

}



취소
 공유
취소
댓글 0
댓글 알림
나의얼굴