找回密碼
 注冊帳號

掃一掃,訪問微社區

component.getcomponents 獲取組件列表

2015-1-5 04:57| 發布者: 楊炎| 查看: 2071| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: component.getcomponents 獲取組件列表functiongetcomponents(type: type) : componentdescription描述returns all components of type type in thegameobject.在游戲物體返回全部type類型組件。c#javascriptusing u ...

component.getcomponents 獲取組件列表

functiongetcomponents(type: type) : component[]

description描述

returns all components of type type in theobject" target="_blank" class="relatedlink">gameobject.

游戲物體返回全部type類型組件。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

publichingejoint[] hingejoints;

public void awake() {

hingejoints = getcomponents();

foreach (hingejoint joint in hingejoints) {

joint.usespring = false;

}

}

}

// disable the spring on all hingejoints in this game object

//在這個游戲物體禁用全部鉸鏈關節上的彈簧

var hingejoints :hingejoint[];

hingejoints = getcomponents (hingejoint);

for (var joint : hingejoint in hingejoints) {

joint.usespring = false;

}

相關閱讀

文章點評
相關文章
女校游泳队彩金