[英]How do I get a value from another script in Unity (with an IEnumerator)?
[英]How do I get this information from another script?
如何在我的 rigTransform 腳本中創建一個執行此操作的 if 語句?:(如果 PickupAndDrop 腳本pickup void Weapon1Layer.enabled = false)
//this script is called RigTransform:
{
PickupAndDrop GET;
public RigTransform rigTransform;
// Start is called before the first frame update
void Start()
{
rigTransform.enabled = false;
}
// Update is called once per frame
void Update()
{
if(GET.PickUp().weapon1Layer.enabled = false)
{
}
}
}
//this script is called PickupAndDrop:
public void PickUp()
{
weapon1Layer.enabled = false;
weapon1Layer.weight = 1f;
currentWeapon = wp;
currentWeapon.transform.position = equipPosition.position;
currentWeapon.transform.parent = equipPosition;
currentWeapon.transform.localEulerAngles = new Vector3(0f, 180f, 0);
currentWeapon.GetComponent<Rigidbody>().isKinematic = true;
}
更改 RigTransform 腳本,使其顯示為:
// Update is called once per frame
void Update()
{
if(!GET.weapon1Layer.enabled)
{
}
}
您還應該公開PickupAndDrop GET
變量,以便您可以自己設置引用或編寫某種 Function 以編程方式執行此操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.