Unity 3D Error CS0103 "The name 'roomNameInputField' does not exist in the current context" hatası

dkk

Decapat
Katılım
19 Nisan 2023
Mesajlar
104
Daha fazla  
Sistem Özellikleri
Windows 10 Pro
İşlemci Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz 2.59 GHz
Takılı RAM 8,00 GB
64 bit
Cinsiyet
Diğer
Unity 3D de online fps oyunu yapıyorum. Bir Script iki tane hata veriyor:

"Assets\Scripts\Launcher.cs(34,34): error CS0103: The name 'roomNameInputField' does not exist in the current context"
ve
Assets\Scripts\Launcher.cs(30,33): error CS0103: The name 'roomNameInputField' does not exist in the current context

C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using TMPro;

public class Launcher : MonoBehaviourPunCallbacks
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Bağlanıyor...");
        PhotonNetwork.ConnectUsingSettings();
    }

    public override void OnConnectedToMaster()
    {
        Debug.Log("Bağlandı.");
        PhotonNetwork.JoinLobby();
    }

    public override void OnJoinedLobby()
    {
        MenuManager.Instance.OpenMenu("title");
        Debug.Log("Lobiye Bağlandı");
    }

    public void CreateRoom()
    {
        if(string.IsNullOrEmpty(roomNameInputField.text))
        {
            return;
        }
        PhotonNetwork.CreateRoom(roomNameInputField.text);
        MenuManager.Instance.OpenMenu("loading");

    }

    public override void OnJoinedRoom()
    {

    }

    public override void OnCreateRoomFailed(short returnCode, string message)
    {
        MenuManager.Instance.OpenMenu("room");
    }
}

kodlarım bunlar. yardım edebilirseniz sevinirim.
 
C#:
public InputField roomNameInputField;
Bu kodu void Start() fonksiyonundan önceki satıra yazıp kaydedin.
Daha sonra editörden oda adını yazdığınız input fieldini scripte verin.
 

Technopat Haberler

Yeni konular

Geri
Yukarı