【发布时间】:2021-08-06 19:02:17
【问题描述】:
我的预制枪在实例化后在我的层次结构中显示为非活动状态。
void IInteractableTarget.Interact(GameObject character)
{
int winningInt = Random.Range(1, 3);
if(winningInt == 1)
{
GameObject obj_rifle = Instantiate(assaultRiflePrefab, spawnPos.position, spawnPos.rotation);
}
if (winningInt == 2)
{
GameObject obj_pistol = Instantiate(pistolPrefab, spawnPos.position, spawnPos.rotation);
}
//GameObject obj = Instantiate(assaultRiflePrefab, spawnPos.position, spawnPos.rotation);
//obj.GetComponent<Rigidbody>().AddForce(transform.up * 5, ForceMode.Impulse);
//Instantiate(assaultRiflePrefab, spawnPos.position, spawnPos.rotation);
Debug.Log("Weapon from chest instantiated" + " " + winningInt);
}
我应该如何处理?
【问题讨论】: