اذهب إلى المحتوى
  • 0

سوال فى محرك الالعاب unity

Aisha Safwat

السؤال

تظهر لى تلك المشكله دائما ولا اعلم السبب 

error CS0103: The name 'countUP' does not exist in the current context

وذلك الcode 

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TimeCount : MonoBehaviour
{
   public int countUp = 1;
  public  Text TimerUI;
    // Start is called before the first frame update
    void Start()
    {
        countUpTimer();
    }
  public  void countUpTimer() { 
    
      if(countUp>0)
        {
            TimeSpan spanTime = TimeSpan.FromSeconds(countUP); 
            TimerUI.text = "Timer:" + spanTime.Minutes +":"+spanTime.Seconds;
            countUp++;
            Invoke("countUp", 1.0f);
        }

ارجوا الاجابه .وشكرا مقدما.

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

تشير رسالة الخطأ هذه إلى عدم التعرف على الاسم "countUP" في السياق الحالي لبرنامج Unity. من المحتمل أن "countUP" لم يتم تعريفه أو تعريفه بشكل صحيح في النطاق الحالي أو مساحة الاسم.

تأكد من كتابة "countUP" بشكل صحيح ، يجب أن تكون "countUp" بحرف u صغير بدلاً من حرف U.
تحقق أيضًا من تعريف المتغير والإعلان عنه قبل استخدامه في دالة countUpTimer ()
تأكد من أن البرنامج النصي الذي يحتوي على متغير "countUp" متصل بشكل صحيح بكائن GameObject المناسب في مشهد الوحدة الخاص بك.
تأكد من استيراد البرنامج النصي بشكل صحيح أو الإشارة إليه في البرنامج النصي الآخر حيث تحاول الوصول إلى متغير countUp.
تحقق أيضًا من عدم استدعاء البرنامج النصي قبل تهيئته.  

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TimeCount : MonoBehaviour
{
   public int countUp = 1;
   public Text TimerUI;
    // Start is called before the first frame update
    void Start()
    {
        countUpTimer();
    }
    public void countUpTimer() { 
        if(countUp>0)
        {
            TimeSpan spanTime = TimeSpan.FromSeconds(countUp); 
            TimerUI.text = "Timer:" + spanTime.Minutes +":"+spanTime.Seconds;
            countUp++;
            Invoke("countUpTimer", 1.0f);
        }
    }
}

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...