判断字符串是否与变量相符
判断字符串是否与变量相符
利用Equals()来判断字符串是否与变量一致
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MainPlayer : MonoBehaviour
{
public string Name;
void Start()
{
if (Name.Equals("LBW"))
{
Debug.Log("欢迎回来");
}
else
{
Debug.Log("不存在的名字");
}
}
}

浙公网安备 33010602011771号