码迷,mamicode.com
首页 > 编程语言 > 详细

unity的结构体中数组的使用

时间:2020-11-18 12:29:14      阅读:5      评论:0      收藏:0      [点我收藏+]

标签:debug   struct   实例   结构   public   数组   影响   unit   实例化   

tips

1.结构体中包含数组,在使用之前,必须实例化,并规定数组的长度;

2.new 出来的长度并不互相影响,new

struct test
{
public string[] strs;
}

test m_test = new test();

m_test.strs = new string[5];
Debug.Log(m_test.strs.Length);
m_test.strs = new string[2];
Debug.Log(m_test.strs.Length);
m_test.strs = new string[6];
Debug.Log(m_test.strs.Length);

 

输出的结果即为5,2,6.

unity的结构体中数组的使用

标签:debug   struct   实例   结构   public   数组   影响   unit   实例化   

原文地址:https://www.cnblogs.com/MoyaoQueen/p/13964216.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!