|
This is very odd! I have a code block that looks like this: It's in the Update() function of a script attached to a prefab. If I create a copy of the prefab at runtime. There's no problem. DoSomething is called when the mouse is clicked. If I have a prefab in the scene, click play, then step through in the debugger and click on the mouse, I can see that the execution steps into the block but DoSomething is not called and execution falls through to "int value = 0;" The code then continues as expected. No exceptions are thrown. Nothing seems amiss. Anyone know why this might be happening? (if I replace Input.GetMouseButtonDown with any other true statement then DoSomething is called fine)
(comments are locked)
|
|
I have found weird issue, if scene has no camera tagged "MainCamera" (so Camera.main is always null) my mouse events doesn't work at all.
(comments are locked)
|

if all you say here is true then I cannot see any error on your part. I'd file a bug report.
When you it falls to int value=0; I would want to take a look at "DoSomething()". Could it be that the function is initiated only when prefab instantiates?
He said that if he replaced the if statement with a true statement it works fine. All I can think of is that the mouseButtonDown messes something inside the DoSomething() method
DoSomething could be just an empty function...