在剧本的顶部:
var bm3 = new ExtrudedTrailSectionBM3();
var section = bm3;
section.point = position;
section.matrix = transform.localToWorldMatrix;
section.time = now;
// using 2 sections
sections.Unshift(section); // back
sections.Unshift(section); // front
然后:
def convert_orders(orders, orderid=None):
"""Converts certain fields of an order object to readable and/or indexable values"""
status = None
color = None
order = None
converted = []
if not orders:
order = session.query(Order).filter(Order.orderid == orderid)
for order in orders:
# convert order status to a string and give it a color for the tables
if order.status == 0:
status = 'In Progress'
color = QColor(150, 255, 250)
elif order.status == 1:
status = 'Ready'
color = QColor(60, 255, 75)
# elif continues below for another 70+ lines, converting other attributes.
但Unshift适用于java脚本,我使用csharp。
答案 0 :(得分:1)
首先,我只建议在检查器中使用数组公共变量进行编辑,除此之外的任何东西都太原始了。
如果您特别需要或想要使用数组,则每次都需要重新创建数据或以其他方式调整数据大小。
尽管使用列表:D
public class temp : MonoBehaviour {
public List<string> myList;
// Use this for initialization
void Start () {
//initialize your list
myList = new List<string> ();
//add to your list
myList.Add("some junk");
string temp = "some more junk";
myList.Add (temp);
//add a new item at a specific index
myList.Insert(0,"The new first item");
//remove the first item: "The new first item"
myList.RemoveAt(0);
//remove everything
myList.RemoveAll();
}
注意:请考虑将来正确格式化您的问题,因为其他人很难在将来查找信息,从而导致重复的问题:)