使用本地资源并构建Unity应用

时间:2018-09-04 07:38:58

标签: unity3d

构建Unity应用后,无法在我的Instantiate文件夹中Resources个对象。这是此构建的output_log.txt的摘录:

ArgumentException: The Object you want to instantiate is null.
  at UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) [0x00000] in <filename unknown>:0 
  at UnityEngine.Object.Instantiate (UnityEngine.Object original, UnityEngine.Transform parent, Boolean instantiateInWorldSpace) [0x00000] in <filename unknown>:0 
  at UnityEngine.Object.Instantiate[GameObject] (UnityEngine.GameObject original, UnityEngine.Transform parent, Boolean worldPositionStays) [0x00000] in <filename unknown>:0 

此错误与我的脚本找不到的预制件有关,并与以下几行有关:

GameObject radio_button = Resources.Load<GameObject>(GlobalConfiguration.Instance.RootPrefabs+"/RadioButton"
foreach (string type in toggle_names)
{
   if (type == string.Empty || type == null) continue;
   GameObject go = Instantiate(radio_button, parent, false);
   (...)

GlobalConfiguration包含RootPrefabs = "Prefabs";

这是预制件的问题,但是我也遇到了外部资源,例如JSON文件。我想念什么?

有关信息,我正在使用VRTK。

0 个答案:

没有答案