Hi everybody! i’ve got a big problem with register input in a sprite using ORTHELLO. this one will be activated on runtime when i click on a specific spot,
i set it visible or not by activating and deactivating the mesh renderer, and at the same time i set active or not the register input of the sprite…
the problem is that when i play the project, the sprite capture the input even if the check box register input is not enabled…please help!!!
here below i post the code…
public class generateSpotStatWindow : MonoBehaviour {
GameObject pop;
OTSprite popSprite;
MeshRenderer popRend;
// Use this for initialization
void Start () {
pop = GameObject.Find(“bottomPanel”);
popSprite = pop.GetComponent();
popRend = pop.GetComponent();
OTSprite sprite = GetComponent();
sprite.onInput=onclick;
}
public void onclick(OTObject sprite)
{
if (Input.GetMouseButtonDown(0))
{
if (popRend.enabled==false)
{
popRend.enabled=true;
popSprite.registerInput=true;
}
else
{
popRend.enabled=false;
popSprite.registerInput=false;
}
}
}
}
on the sprite renedered i’ve linked this other script
public class print : MonoBehaviour {
OTSprite sprite;
// Use this for initialization
void Start () {
sprite=GetComponent();
sprite.onInput=click;
}
void click(OTObject sprite)
{
if (Input.GetMouseButtonDown(0))
{
Debug.Log (“hell yeah!”);
}
}
}
well as i explained before, the debug log will show ‘hell yeah’ even if the sprite is not rendered and the checkbox of register input is not checked…