make a prefab and different icons

I have a question about making a prefab and the different prefab icons.

I have two models imported jeepbody3ds.3ds and jeepwheel3ds.3ds

I import them and then add colliders then drag them onto a new prefab. It turns into a grey box.

Upon loading this prefab with the script

theobject = Resources.Load(otype);
	Debug.Log(theobject);
	go=Instantiate(theobject);

Unity thinks is an Object…not a GameObject so things like AddComponent do not work.

There are three different icons in the project
I’ve got a blue box (cow)
and a blue box with a paper on it.(cowold) works
and the grey box (jeep)doesn’t work.

The blue box with papers load fine using that code.
The grey box type does not.

Anyway I’m totally failing at this prefab stuff after 2 days of fooling around.

Dan

A grey box is an empty prefab. A blue box with a paper is not really a prefab, it’s an asset. Only a blue box (no paper) is a proper prefab.

To make a prefab, do Create → Prefab. Then drag what you want onto it. It’s usually easiest to create game objects in the scene, then drag the object from the hierarchy view onto the empty prefab in the project view.

–Eric

notice that in the screen shot the empty prefab which is grey labeled jeep has two assets in them.

So a prefab cannot be made with assets but instead has to be made with game objects?

When you instantiate a asset does it automatically get attached to a gameObject?

Why is my LoadResources.
Instantiate code not creating a gameObject?

Thanks,
Dan

The blue box signifies that there is a single GameObject under the prefab (therefore the prefab and GameObject can be treated as essentially the same thing). When you place two GameObjects at the root of a prefab you get the grey box because the prefab doesn’t represent a single GameObject. If you want to be able to load the prefab as a single GameObject then you should parent your two objects under one root and then put that root object in the prefab.

To answer your questions in the second post:

You can generate a prefab from an asset, but that’s what Unity does internally anyway. When you import an asset Unity generates a GameObject which contains the contents of that asset. Therefore you can generate a prefab with an asset, but it’ll just be the same as the GameObject auto generated by Unity.

Object.Instantiate returns and Object, so it needs to be cast to a GameObject.

Thanks,

That clears up a lot about Object and GameObject and what the icons mean. I didn’t see this in the docs is it there somewhere?

Thanks for the tips.
Dan