Question by
chris_mouzakiscs · May 01, 2020 at 09:38 AM ·
getcomponent
GetComponentInChildren
hi! i am a begginer in and c#. i have thiw issue: i have a game object named "piata" and it has childen. the game object has o box collider which is trigger so i wrote this: void OnTriggerStay(Collider collision) { if (collision.gameObject.name == "piata") { Debug.Log("Ήρθα σε επαφή με:" + collision.gameObject.name); if (Input.GetKeyDown(KeyCode.F)) { collision.GetComponentsInChildren().enabled = false; } } } but it doesn't work. any ideas for what i made wrong?
Comment