【发布时间】:2022-11-30 03:46:49
【问题描述】:
我只想在另一个函数中使用实例化的 GameObject 但它总是说 当前上下文中不存在名称“newObject”
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Deletenow : MonoBehaviour
{
public Transform Player;
public GameObject myObject;
public Vector2 thisVector;
void Start()
{
thisFunction();
}
void Update()
{
thisVector = newObject.transform.position;
}
public void thisFunction()
{
GameObject newObject = Instantiate(myObject, Player.transform.position, Player.rotation);
}
}
我找不到任何可以帮助我的资源
【问题讨论】:
标签: unity3d instantiation void