Hello all, for my game
I have a Canvas
where the user can scroll through to select an item (using Scroll Rect
). I have a collider in the center of the screen. The purpose of this collider is to detect which item is in the center of the screen (yes, the other images in the Scroll Rect
has 2D colliders on them).
The goal is to display the name of the item that is in the center of the screen by detecting a collision with the collider (that is a trigger) in the middle of the screen, and the collider on the items that are being scrolled through. Here’s a snippet of my code:
public void OnTriggerEnter2D (Collider2D other)
{
Debug.Log ("New item in center of screen");
Text _text = GameObject.Find("Name").GetComponent<Text> ();
_text.text = other.gameObject.name;
}
As the code states, when an image that has a 2D collider on it enters the collider in the middle of the screen, the name of the item should be displayed. This is not happening.
Any help!?