GameObject.Find()优点: 使用简单方便不会因为重名而报错,同时查找的是自上而下的第一个物体缺点 不能查找被隐藏的物体,否则出现“空引用异常”,这是很多新人在查找出现空引用bug的原因.全局查找(遍历查找),查找效率低,很消耗性能.代码演示: using System.Collections;using System.Collections.Generic;using UnityEngine; public class GameObjectFind : MonoBehaviour
感谢网友分享,原文地址(How to Make an Object Shatter Into Smaller Fragments in Unity),中文翻译地址(Unity实现物体破碎效果) In this tutorial I will show you how to create a simple shattering effect for your Unity game. Instead of just "deleting" a crate (or any other obje