Go to the object editor and press ctrl + D or go to view: Display values as raw data. Now you can see the unit codes of the units. For a footman it's hfoo for example.
If you crete a new custom unit the unit code will be automatically created depending in the race of the base unit. For example a custom unit with a human base unit will have: h000. The h is for human and the numbers will increase every time you create a new human custom unit.
The problem is, you cannot change unit codes. This is why your object data should be roughly the same on each level.
To assure that your object data is consistent over all the levels of your campagin you should do:
Create a map with all the object data, you need in every level (undead race, elf race,...).
Use the object editor and go to file: Export all object data...
Save your object data to a file.
Then you have two options:
1. Use the campagin editor and go to custom data and import your object data there.
2. Import the object data into every map in your campagin.
Both options are valid. Option 1 is good, because you only have to make changes once.
Option 2 is good, because you can also have maps with very different object data.
Another thing I noticed, is that you import your imported files in every map. You can do this, but it is better to use the campagin editor for this. The reason for this is, that if you import them in every map, the file size of your campaign will be huge, since the same data is stored once for each level. It will be a lot of work to import all the files into the campagin editor, but it will be necessary to keep file size low.
However if you import the files via the campaign editor, the imported files will show up ingame, if you play the campaign via play custom campagin. If you test the map with the world editor, the files will not show up (because they are not loaded from the map, but from the campaign).
This is why I change the model of all units, that use imported models into a standard model to be able to test the game with working models. Once you are finished with your campagin, you can change the models back to the imported models.
These are tips, that I would recommend to follow, because they will make your life much easier. If I had known these things before, it could have saved me much time.
If you need more help with these things feel free to ask.