unity C# 將字串轉換為整數型別失敗
阿新 • • 發佈:2021-01-31
unity C# 將字串轉換為整數型別失敗(小白求指點)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class updating_data : MonoBehaviour
{
private GameObject info_panel;
private GameObject info_panel1;
private GameObject info_panel2;
private GameObject info_panel3;
private GameObject info_panel4;
private GameObject info_panel5;
private int RingNum ;
private string content;
private string content2;
private GameObject tunnel_self;
// Start is called before the first frame update
void Start()
{
info_panel = GameObject.Find("TunnelInfoPanel");
tunnel_self = GameObject.Find(this.gameObject.name);
content = this.gameObject.name;
content2 = content.Substring(6, 4);
RingNum = Convert.ToInt32(content2, 2);
}
}```
最後一行的**RingNum = Convert.ToInt32(content2, 2);** unity提示錯誤:
Assets\updating_data.cs(29,19): error CS0103: The name 'Convert' does not exist in the current context
小白剛剛開始上手unity,求各路大神指點。: D