小编Est*_*ban的帖子

当前上下文中不存在名称“实例化”

我正在学习 Unity C#,我正在做 Unity 的教程,2d roguelike,我们正在尝试实例化地砖,我所做的与视频中完全相同(实际上我什至复制了代码),但它显示了一个错误在线上

GameObject instance = Instantiate(toInstantiate, new Vector3(x, y, 0f), 
    Quaternion.identity) as GameObject; 
Run Code Online (Sandbox Code Playgroud)

特别是与Instantiate(toInstantiate).

你能帮助我吗?

using UnityEngine;
using System;
using System.Collections.Generic;
using Random = UnityEngine.Random;

public class BoardManager : MonoBehaviour 
{
    // Other class code omitted

    void BoardSetup()
    {
        boardHolder = new GameObject("Board").transform;

        for (int x = -1; x < columns + 1; x++)
        {
            for (int y = -1; y < rows + 1; y++)
            {
                GameObject toInstantiate = floorTiles[Random.Range(0, floorTiles.Length)];

                if (x …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine

3
推荐指数
1
解决办法
6877
查看次数

标签 统计

c# ×1

unity-game-engine ×1