#pragma strict
var target : Transform;
function Start () {
}
function Update () {
if(target.active){
gameObject.transform.position.x= target.transform.position.x;
gameObject.transform.position.z= target.transform.position.z;
}
}
最佳答案
如果要检查游戏对象是否处于 Activity 状态,请使用 activeSelf或 activeInHierarchy如下:
if( target.gameObject.activeInHierarchy )
此外,我认为您无法分配职位的各个组成部分(至少,在 C# 中,您不能)。您必须将位置存储在临时变量中:
var position : Vector3 = transform.position;
position.x = target.position.x;
position.z = target.position.z;
transform.position = position;
关于android - Assets /shadow.js(9,19) : BCE0019: 'active' is not a member of 'UnityEngine.Transform' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47809157/