Greetings. I have had a problem quite a long time without being able to solve it myself. Therefore I turn to you guys in hope for some answers =)
My problem is that whenever I import my spaceship I created in maya and textured in photoshop it works fine. I can drag the spaceship prefab to the scene and it looks good. But I cannot add a javascript to it.
To add a javascript to my spaceship I need to drag the prefab spaceship to the scene, add a javascript and sacrifice my prefab connection.
I tried to create a new prefab in my spaceship folder to connect back the spaceship with the script. It works as long as I dont restart unity.
When I done that I save both the scene and the project and the next time I open the project and the scenee my spaceship is "empty". I see no models, no textures, no nothing.
I think I only need to learn to add a javascript to a prefab while it is in the project menu. How do I do that? If I can't do that, how else can I fix my problem?
Imported meshes are not "real" prefabs; the icon is different. The correct thing to do is to add scripts or whatever to the object, do Create -> Prefab, then drag the object onto the empty prefab, and name it appropriately. This is now a "real" prefab and will behave correctly. You can delete it from the scene if you don't need it right away. If in the future you add anything to it, breaking the prefab connection is not a concern. Just make the additions and do Apply Changes to Prefab from the GameObject menu. You can add scripts to prefabs directly with the Component -> Scripts menu.
I had similar problems with meshes imported in FBX format from 3Dmax, what I did was to make an empty GameObject and renamed this to be my "objects axis". Then I attached the meshes and javascripts to that object + it allowed me to add other childobjects relative to the object center too.
By scripting you can easily find child objects and control them.