Hi,
I’m beginner and I’m creating game for spawning objects on 2D tilemap. Spawned objects are only sprite renderer with C# script, rigidbox 2d and circle collider 2d (just for circle shape). So I’m in phase to use attached script to get OnMouseEvents but with maximal effort I’m not able to fix bug/feature to be able to call these events.
I’m currently have scene with tilemap grid and canvas. Grid for tilemaps and Cavnas for menu selection. I’m able to raycast clicks on spawned objects from TileManager for certain purposes - right now for Debug.Log(). The click and a object spawned have nice intersection. But I want to be able to catch these events separated on every spawned object.
Unity hierarchy:
https://ibb.co/p3QcyXg
Object properties:
https://ibb.co/Y3nKP0s
Script in spawned object:
public class TileResource: MonoBehaviour
{
public GameObject go; //own object where the script is attached
void OnMouseDown()
{
Debug.Log("CLICK...");
}
}
I’m not able to resolve it. Any idea post it please? Enabling IsTriggered doesnt help.
I have also checked this Unity - Manual: Order of execution for event functions. I didn’t tried all but most of it.