zoukankan      html  css  js  c++  java
  • Object.Instantiate 实例

    static function Instantiate (original : Object, position : Vector3rotation : Quaternion) : Object

    Description描述

    Clones the object original and returns the clone.

    克隆原始物体并返回克隆物体。

    Clones the object original, places it at position and sets the rotation to rotation, then returns the cloned object. This is essentially the same as using duplicate command (cmd-d) in Unity and then moving the object to the given location. If a game object, component or script instance is passed, Instantiate will clone the entire game object hierarchy, with all children cloned as well. All game objects are activated.

    克隆原始物体,位置设置在position,设置旋转在rotation,返回的是克隆后的物体。这实际上在Unity和使用复制(ctrl+D)命令是一样的,并移动到指定的位置。如果一个游戏物体,组件或脚本实例被传入,实例将克隆整个游戏物体层次,以及所有子对象也会被克隆。所有游戏物体被激活。

    // Instantiates 10 copies of prefab each 2 units apart from each other
    //实例化10个 prefab拷贝,间隔2个单位
    var prefab : Transform;
    
    for (var i : int = 0;i < 10; i++) {
    	Instantiate (prefab, Vector3(i * 2.0, 0, 0), Quaternion.identity);
    }

    Instantiate is most commonly used to instantiate projectiles, AI Enemies, particle explosions or wrecked object replacements.

  • 相关阅读:
    四色定理+dfs(poj 1129)
    栈的应用:表达式求值运算
    多重背包 (poj 1014)
    poj 1080 (LCS变形)
    KMP算法(快速模式匹配)
    贪心+构造( Codeforces Round #344 (Div. 2))
    JavaScript Ajax
    Canvas绘图
    TCP/IP协议
    移动端click事件延迟300ms到底是怎么回事,该如何解决?
  • 原文地址:https://www.cnblogs.com/pangblog/p/3299289.html
Copyright © 2011-2022 走看看