unity3D教程之Instantiate

更新时间:2023-05-22 10:48:38 阅读: 评论:0

Instantiate duplicates an object. Including all attached scripts and the entire hierarchy. It keeps references in the way you expect it: References to objects outside the cloned hierarchy will be left untouched, References to objects in the cloned hierarchy will map to the cloned object.
bpo是什么意思
实例化一个对象,将包含该对象已有的全部脚本和它的全部继承关系(比如子物体和组件).这可以保证你以期望的方式引用它:可以原封不动的将对象的继承关系复制到你的新对象中.狗刨学习网
Instantiate is incredibly fast and very versatile. It is esntial to using Unity to its fullest.
实例化非常快捷,而且是多用途的.在使用Unity的过程中充分利用它是非常必要的.
For example here is a tiny script that when attached to a rigidbody with collider will destroy itlf and instead spawn an explosion object
例如这是一个小脚本,当碰撞体接触后销毁自身对象,并创建一个爆炸对象.uuid
C#
JavaScript
using UnityEngine;
amor
using System.Collections;
bbc纪录片 中国新年 public class example : MonoBehaviour {
    public Transform explosion;
    void OnCollisionEnter() {
        Destroy(gameObject);
        Transform theClonedExplosion;
        theClonedExplosion = Instantiate(explosion, transform.position, ation);
    }cels
周一到周日的英文}
var explosion : Transform ;
// When a collision happens destroy ourlves
// and spawn an explosion prefab instead
// 当一个碰撞发生自毁
// 和产生爆炸预制物代替
function OnCollisionEnter (){cute是什么意思英文
    Destroy (gameObject);
    var theClonedExplosion : Transform北京油画学校 ;
症状英文    theClonedExplosion = Instantiate(explosion,transform.position, ation);
}
Instantiate is usually ud in conjunction with Prefabs .
实例化常和 Prefabs 一起使用.
旅游 英语

本文发布于:2023-05-22 10:48:38,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/118234.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:对象   期望   关系   全部
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图