The original object's OnMouseDown function works fine but when I instantiate the prefab at run time, it doesn't. I have other objects being instantiated and there OnMouseDown works fine. Any ideas? I've tried adding a rigid body to the instantiated object but get an tensor error.
Am I forgetting something?
If possible we'll need to take a look at your script but at mean tine,
Here are some basic stuff you can check for:
1) Did you rename the prefab correctly? ( If you haven't renamed it it'll carry the same name but with an additional "(clone)" concat to it ) as the back. The idea hare is that we need to make you're you're calling the correct object.
2) If you're refering to the created prefab object by hard coding the name in the mouse down script then you might be calling the original or first prefab initiated in your script with the same name. The idea once again is to make sure you're calling the correct object.
3) Check if your the the script you care concerned with is attached and saved as part of the prefab.
4) Next lets check if the mouse down was even being called in the first place. To do this i suggest we could place a print statement in the mouse down event like this: print("Mouse down was detected"); --- so we can know for sure it was called.
5) If step 4 shows that it was called then you can be sure that your object and every thing works fine. The problem probably lies and some "if - else" statement in your mouse down code segment. You only need to place that print statement in each segment to test if they were correctly called at the given conditions and alter those conditions that are wrong.
Once again its better if you could share a little of your code if its alright with you.