【问题标题】:Unity3D: How to show mesh in scene?Unity3D:如何在场景中显示网格?
【发布时间】:2023-04-09 19:34:01
【问题描述】:

我有 c# 类:

class VisualElement { 
   private GameObject mesh {get; set;};
   public VisualElement(){
      mesh = Gameobject.find("Models/VE");
   }  
   public void showMesh(GameObject player){
      //TODO show mesh
   }
}

我需要做什么才能让我的元素显示在场景中?

我可以从玩家那里得到我想要放置网格物体的位置。

【问题讨论】:

    标签: c# unity3d scene


    【解决方案1】:

    它在manual 中。此外,GameObject.Find 用于查找场景中已经存在的游戏对象。如果您想从文件中加载资产,请使用Resources.Load

    另一方面,我 90% 确定您根本不需要这门课。每次您创建 VisualElement,只需 instantiate a GameObject,Unity 将为您完成所有工作。

    【讨论】:

      猜你喜欢
      • 2018-06-23
      • 2017-01-29
      • 2021-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多