c# - NullReferenceException:对象引用未设置为 lin 25 的对象 Item..ctor(ItemObject 项)的实例
问题描述
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum ItemType
{
Stone,
Default
}
public class ItemObject : ScriptableObject
{
public int Id;
public Sprite uiDisplay;
public ItemType type;
[TextArea(15,20)]
}
[System.Serializable]
public class Item
{
public string Name;
public int Id;
public Item(ItemObject item)
{
Name = item.name;
Id = item.Id;
}
}
在这里一次又一次地将对象引用设置为对象的实例似乎无法修复它。请帮助解决这个问题。先感谢您!
解决方案
推荐阅读
- javascript - 在 react native 中将类组件转换为钩子形式
- c - C中的游戏帮助,连接买卖的函数(带价格)
- javascript - 在 VueJS 3 中全局使用 momentJS
- javascript - 将文件拖放到 Chrome 的 textarea 中时获取光标位置
- javascript - 使用 WebAudioAPI 访问手机麦克风不会检测到声音(或失真的声音)
- database - 在此示例中,列式数据库与 RDBMS 相比如何更快
- java - 在 mongodb 和 spring-boot 中计算具有条件的数组对象
- r - 加权 k 最近邻和 R kknn 包
- mysql - MySQL:优化子查询
- c - C 接收来自特定进程的信号