c# - 访问数组中的变量?
问题描述
我在这里有这个小块,但我想知道是否可以使用GetTile()
数组中的特定变量。
编辑:我的整个脚本是:
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class walltilemap : MonoBehaviour
{
public TileBase Ground_tiles_3;
public Vector2Int size;
void Start(){
Vector3Int[] positions = new Vector3Int[size.x * size.y];
TileBase[] tileArray = new TileBase[positions.Length];
for (int index = 0; index < positions.Length; index++){
positions[index] = new Vector3Int(index % size.x, index / size.y, 0);
bool iswalltile() {
if (Tilemap.GetTile(positions[index])){
}
return true;
}
tileArray[index] = iswalltile() == true ? Ground_tiles_3 : null;
}
Tilemap WallTileMap = GetComponent<Tilemap>();
WallTileMap.SetTiles(positions, tileArray);
}
}
解决方案
推荐阅读
- arduino - Arduino shield SIM900 不响应 AT 命令
- python - 如何根据 Python 中的条件创建结果组合矩阵?
- kotlin - Kotlin - 在 hashmap 上使用 apply 或 also 不能按预期工作
- facebook - 主域和子域不同的 Facebook 评论系统
- node.js - 护照认证超时
- javascript - 重新排序和过滤对象数组
- android - Ionic Android 支持的最低 Gradle 版本为 4.6。当前版本是 4.1
- scom - SCOM - 查看上次登录的用户
- vba - Excel VBA - 密码保护工作表
- javascript - 链接可观察对象 Angular 5 / Rxjs