# Problem using the same script for different objects

**URL:** <https://discussions.unity.com/t/problem-using-the-same-script-for-different-objects/819954>\
**Category:** C# & .NET\
**Tags:** Scripting, Mono\
**Created:** [December 9, 2020, 6:59pm UTC](https://discussions.unity.com/t/problem-using-the-same-script-for-different-objects/819954 "2020-12-09T18:59:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Kurt-Dekker](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kurt-dekker/32/101578_2.png) [@Kurt-Dekker](https://discussions.unity.com/u/Kurt-Dekker)\
**Post date:** [December 9, 2020, 7:15pm UTC](https://discussions.unity.com/t/problem-using-the-same-script-for-different-objects/819954/2 "2020-12-09T19:15:54Z")

</div>

Inside this function:

OnTriggerEnter2D(Collider2D other)

print the name of this GameObject:

`Debug.Log("OnTriggerEnter2D(Collider2D other): I am " + name);`

So you can see what is triggering what and when.

You could also print the name of the CalzonSiguiente, which sounds absolutely delicious.

Also, please use code tags: [Using code tags properly](https://discussions.unity.com/t/481379)

Generally to solve this sort of thing, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

- is this code even running? which parts are running? how often does it run?
- what are the values of the variables involved? Are they initialized?

Knowing this information will help you reason about the behavior you are seeing.

---

_[View the full topic](https://discussions.unity.com/t/problem-using-the-same-script-for-different-objects/819954)._
