Not allowed to access Renderer.materials on prefab object. Use Renderer.sharedMaterials instead
UnityEngine.Renderer:get_materials()

 

如果是Resource.Load的预制件,在代码中用.materials访问会报上述错,要new一份再使用,即 GameObject.Instantiate (res) as GameObject;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2021-11-29
  • 2021-04-09
  • 2021-10-12
  • 2021-10-16
  • 2021-10-29
猜你喜欢
  • 2021-11-03
  • 2022-12-23
  • 2021-06-16
  • 2021-11-27
  • 2022-12-23
  • 2021-09-21
  • 2021-12-03
相关资源
相似解决方案