unity3d add mesh collisions without breaking prefabs

This is probably a simple solution… But I just can’t figure it out. I am trying to add mesh collisions to my game level, without breaking the “asset” prefab.

Basically… I have the entire game level in MAX. And I import that into Unity. I need to add some mesh collisions to some meshes inside of the “level.max” asset prefab, but can’t without breaking the prefab.

I don’t want to lose the prefab, because I am constantly making updates to the level, and the “level.max” file won’t update in Unity automatically, because the prefab is broken.

Any easy solutions?

The loosing prefab connection tells you that you are changing something on your prefab. After doing so you can use Apply changes to prefab. Then your prefab gets updated. Its also represented in a colorchange of the gameobject.

Check this link Unity - Manual: Prefabs (Appplying Changes)

Hey Adam,

This is a big PITA, that is currently very hard to solve.
Unity really prefers it if you only make “assets” in max, and assemble them into a level in unity. Any other working method is a lot more painful.

What we do currently is specify in max that I want a meshcollider attached by writing it in the user properties in max. Unfortunately the user properties don’t make it trough the regular fbx export-import process. However, you can make a maxscript that takes any settings from any max object’s user defined properties, and “encode that” in the object’s name. so if you have:

Plane01

with a userproperties of:
meshcollider=1
rigidbody=1

you can put that information in the object’s name in a maxscript that handles your export:

Plane01_meshcollider=1_rigidbody=1

I personally do a base64 encode, just to make sure I don’t hit any characters that might not be liked.

In Unity, you can write an AssetPostProcessor that recognizes objectnames with these properties attached.
The asset postprocessor can remove these properties from the objectname, and apply the required components.

So yeah. quite a pain :). I logged a featurerequest a while back to at least expose max’s user properties (they actually are present in an fbx file), so that we don’t have to do all the “encode in objectname” bs.
The easiest way is really to assemble your scene in Unity. The reason we’re not doing that currently is because we want to do lightmapping in max, and Unity’s placement tools are very immature. (no snapping, etc).

Bye, Lucas