The Vertex Answer was what I was after, Thank you a lot !
I’m going to try to gather infos on EventSystem and IPointerClickHandler, but if you have an example somewhere I’m all for it !
Ah wasn’t aware of OnMouseUpAsButton !
But last time I tried allowedToColor = !allowedToColor; I Monodevelop sent an error…
Kiwasi, I love the simplicity of your code (the OnMouseUp part) !
Still trying to figure out the event part
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mouseResponse : MonoBehaviour {
bool isRed; //declare var bool
Color initColor; //declare var color
void Start()
{
initColor = GetComponent<Renderer>().material.GetColor("_Color"); //set la valeur de initColor comme etant celle de la couleur du materiau de base
}
public void OnMouseUp(){
isRed = !isRed;
if (isRed) {
GetComponent<Renderer> ().material.color = Color.red;
}
else
{
GetComponent<Renderer> ().material.color = initColor;
}
}
}
I get the “overal” idea of the IPointerClickHandler (PointerEventData eventData) thank’s to your tutotial
Is it right to think it filters the clicks of the mouse considering the UI as a mask (above the 3d objects), or is it something else ?