纳金网

标题: 怎么定义二维数组,多维数组?? [打印本页]

作者: 她。    时间: 2012-11-10 08:25
标题: 怎么定义二维数组,多维数组??
怎么定义二维数组,多维数组??来个神救救我吧,
作者: 仅供参考。    时间: 2012-11-10 08:32
如果是系统内置类的话,代码如下:
using UnityEngine;
using System.Collections;
public class MultiDim {

public static Texture2D[,,] IntTexture2D(int a, int b,int c) {
        return new Texture2D[a,b,c];//unity 内置型
    }
     
public static int[,] IntArray (int a, int b) {
        return new int[a,b]; //int 型
    }
}
(注:将此脚本命名为MultiDim,放在标准资源包的Script文件夹下)
在你需要的脚本中声明和定义,例:
private var pipes  = MultiDim.IntArray(0,0);

作者: may    时间: 2012-11-30 04:03
支持一下楼主




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5