- Home /
AddComponent returns null on iPhone but works fine in Editor
I add a FixedJoint to a box when a ball hits it and then I want to set it's connectedBody to the RigidBody of the ball. This works fine in the Editor but crashes on the device (iPhone/iPad). This never happened before Unity 4 Beta.
Here's the code;
collision.gameObject.AddComponent().connectedBody = _RigidBody; // Crashes here - null exception
Have you tried to use Unity Remote (http://docs.unity3d.com/Documentation/$$anonymous$$anual/unity-remote.html)? Just to see if some error appear in the editor.
Unity Remote is just running in the editor on your computer. It streams video from the editor and gets input events back from the device. Therefore it's not at all helpful when dealing with behavior specific to running on the device.
Your answer
Follow this Question
Related Questions
Multiple conected bodies for joint? 0 Answers
Adding FixedJoints causing crashes and hangs 1 Answer
Physics for multiple connections - advice needed 0 Answers
Loop crashing unity (pathfinding) 2 Answers
Crash of exe with Application.Quit() 0 Answers