在unity上尝试使用Resources.Load()时,我得到了一个错误CS0234

本文关键字:CS0234 错误 一个 Resources unity Load | 更新日期: 2023-09-27 18:00:13

Assets/Resources/Game/Game.cs(15,53):error CS0234:类型或命名空间名称Load' does not exist in the namespace Resources'。是否缺少程序集引用?

using UnityEngine;
using System.Collections;
using InControl;
public class Game : MonoBehaviour {
private float _originalTimeScale;
private float _slowMoTimeScale;  //slow motion time scale
private float _fastMoTimeScale;  //fast motion time scale
private float factor = 4f;      //factor to increase or decrease the timescale by
// Use this for initialization
void Start () {
    GameObject playerPreFab = Resources.Load("Ethan", GameObject);
...

在unity上尝试使用Resources.Load()时,我得到了一个错误CS0234

您缺少Resources.Load的一些语法。它应该是:

(GameObject)Resources.Load("Ethan", typeof(GameObject))

在你的情况下。