I know most components of TMP have a ‘Raycast Target’ flag we can unset if we need to.
But, with the InputField type, there is a ‘caret’ that is created at runtime, that has ‘Raycast Target’ turned on, and there is no reference to this object, so I could disable it etc, or I couldn’t find any type of setting in the inspector to get it to create the caret without it, since the caret seems to be created on the fly with no template anywhere I can find.
Is there any possibility of having a setting for this or something, so that I can control the flag on carets?
I’m trying to disable it, so that I can have my own script on it can implement IPointerClickHandler.
I’m trying to ‘color’ a box that is around the textfield when it has focus, so I need to know when its been clicked, but the caret it taking the ‘click’.
Since the Caret inherit from MaskableGraphic, by default the Raycast is enabled. However, I can disable that by default given I don’t think anyone would ever need to Raycast against the caret itself.
You should be able to get a reference to the caret possibly using FindObjectOfType and set raycastTarget = false on it.
Did this ever get addressed? I am currently running into this issue myself. I want to be able to click on an object that contains a TMP_InputField, but the inputfield blocks clicking on the object due to the Caret
Yeah, I don’t think this ever got addressed. Running into the same issue on TMP 3.0.6, Unity 2021.1.17f1. I GetComponentInChildren<TMP_SelectionCaret>().raycastTarget = false; on Start of my components as @Stephan_B suggested.
Any updates if it is possible to set the SelectionCaret component raycast target to false by default without having to use GetComponentInChildren? I’d like to avoid using it due to performance reasons