Timeline for how to detect touch on instantiated prefabs in unity
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 16, 2019 at 12:34 | comment | added | DMGregory♦ | "The object that is colliding with it" is, in this case, the user's finger touching the screen, not an in-world collision between two physics bodies. | |
May 16, 2019 at 11:57 | comment | added | thirteen4054 | you mean rigidbody on prefab? then no | |
May 16, 2019 at 11:54 | comment | added | Pete Bloom | One of the colliders has a rigid body? Either on the object you're colliding with or on the object that is colliding with it. (sorry, yes I misread it. I deleted the comment pretty swiftly but I guess it showed up anyway.) | |
May 16, 2019 at 11:54 | comment | added | thirteen4054 | the outer ones are for void OnTriggerEnter2D(Collider2D collider) and in them is if statement. | |
May 16, 2019 at 11:50 | comment | added | thirteen4054 | yes i checked is trigger on prefab. | |
May 16, 2019 at 11:48 | comment | added | Pete Bloom | Have you checked 'is trigger' on the game object (in the Inspector panel)? | |
May 16, 2019 at 11:45 | comment | added | thirteen4054 | I used this in my gameController and added a tag "bubble" to my prefab but when I touch any bubble its not giving output | |
May 16, 2019 at 11:45 | comment | added | thirteen4054 | void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject.CompareTag("bubble")) { Debug.Log("detected"); } } | |
May 16, 2019 at 11:37 | comment | added | Pete Bloom | No, or at least I didn't need to do that. I just made them prefabs and named/tagged them as needed. | |
May 16, 2019 at 11:28 | comment | added | thirteen4054 | do i need to store all the instantiated objects in a list to do this? | |
May 16, 2019 at 11:14 | history | answered | Pete Bloom | CC BY-SA 4.0 |