Singapore-MIT GAMBIT Game Lab spacer
spacer New Entries Archives Links subheader placeholder
left edge
The case of the haunted game model

Even now, when I'm more or less familiar with Unity, I occasionally make dumb little mistakes. For one thing, I keep forgetting that any settings that I change in Play mode will reset themselves when Play mode is turned off. Today, I've been reminded once again to be very careful when selecting a Unity object by clicking on the object directly.

I first discovered the problem when my avatar began bumping up against an invisible object. I thought at first it might be a wall I couldn't see from this angle, since planes in Unity are only visible from one side, but there didn't seem to be a wall anywhere nearby.

I moved the avatar around some more and discovered another spot where it behaved oddly, this time climbing on top of a phantom object. About then, I remembered that there had previously been an object on that spot which the avatar had climbed on top of when I moved it there. Was my scene being haunted by the ghosts of objects past?

A little investigation turned up the problem. Earlier, I had indicated some objects I wanted to move by clicking on them directly, rather than selecting them in the hierarchy. As a result, in each case I had actually moved one of the children of the object, not the object itself. The part I moved contained the mesh renderer and all the visual components, so it looked as if I had moved the whole thing, but I had actually left the collider and all the physics components behind--hence the phantom barrier my avatar had encountered.

Here's a picture of my avatar with the phantom bathtub:

ghost tub.JPG

The silver lining is that this incident led me indirectly to the solution to a different problem: it explained why the chasers hadn't been turning black when the script told them to. Because the visual components were in the child object, I should have told the child to turn the object black, rather than adding a renderer to the parent. Now if I can just make that work in a script...

right edge
bottom curves