Creating Prefabs in unity

Guides Creating Prefabs in unity

VamTastic

Invaluable member
Featured Contributor
Messages
468
Reactions
4,944
Points
123
VamTastic submitted a new resource:

Creating Prefabs in unity - simple guide

MacGruber has a brilliant guide about assetbundles , including creating prefabs.

I have done this as simple 4 step by step guide to creating Prefabs



View attachment 56474View attachment 56475
View attachment 56476
View attachment 56481
View attachment 56487

Read more about this resource...
 
I'd add two things so that beginners do not become crazy :
  • Think about zeroing the prefabs as you'd want them in VaM (in your example, I would put the bottom of the building at 0/0/0)
  • Suggesting to drag and drop the folder instead of the prefabs individually. By using a folder, it is extremely easy to update the package because you know that you only have a folder to drop. If you start to take a prefab here and there, this is the perfect way to update a package and forget a few things ;)
 
Hi. Bit confused how to apply custom textures to Unity created assets.
Can apply them in Blender, when go to save them in Unity, it seems to just convert the form in FBX format.
 
I'd add two things so that beginners do not become crazy :
  • Think about zeroing the prefabs as you'd want them in VaM (in your example, I would put the bottom of the building at 0/0/0)
  • Suggesting to drag and drop the folder instead of the prefabs individually. By using a folder, it is extremely easy to update the package because you know that you only have a folder to drop. If you start to take a prefab here and there, this is the perfect way to update a package and forget a few things ;)
thanks Hazmhox , i have updated the guide, the building was already at 0/0/0 position but was an oversight on my part with the y postion .:)
 
Hi. Bit confused how to apply custom textures to Unity created assets.
Can apply them in Blender, when go to save them in Unity, it seems to just convert the form in FBX format.
Hi , what version of blender are you using ? as i am using 2.79 b , as i dont get on with the new 2.8 , 2.9 + layout , had issues with obj and xps exports with material and textures missing , i even tried using the correct material node setup in cycles to make it compatible when exporting ,i gave up . but this thread may help https://developer.blender.org/T68399 .
exporting an object from blender then placing the obj or fbx and textures in your project assets folder in unity, if the objects material are missing the textures ,
here is a quick guide , though not ideal for objects that have lots of materials and textures
texture-unity1.png texture-unity2.png
 
Hi , what version of blender are you using ? as i am using 2.79 b , as i dont get on with the new 2.8 , 2.9 + layout , had issues with obj and xps exports with material and textures missing , i even tried using the correct material node setup in cycles to make it compatible when exporting ,i gave up . but this thread may help https://developer.blender.org/T68399 .
exporting an object from blender then placing the obj or fbx and textures in your project assets folder in unity, if the objects material are missing the textures ,
here is a quick guide , though not ideal for objects that have lots of materials and textures
View attachment 56698 View attachment 56699

Thanks. Yea, using Steam version. 2.9.
 
? Im not sure why this is such a pain! How do you import a file into Unity and have the textures and materials already on the object. gitf files imported into Blender equip the Materials.. Am I exporting them as objs wrong from Blender? At least unreal asks what you'd like to do with them when you import objs. Unity just makes everything white.. How do you import the mtl file along with the obj or the gitf?
 
? Im not sure why this is such a pain! How do you import a file into Unity and have the textures and materials already on the object. gitf files imported into Blender equip the Materials.. Am I exporting them as objs wrong from Blender? At least unreal asks what you'd like to do with them when you import objs. Unity just makes everything white.. How do you import the mtl file along with the obj or the gitf?

I took me litteraly 25 seconds to find this information on the internet.
 
Thanks. That wasnt the first vid that popped up for me lol.
No problem! Honestly, I'm doing all my mats manually, the auto thing is cool, but most of the time, when you got your own shader, it doesn't work out of the box :(
 
Thanks. That wasnt the first vid that popped up for me lol.
with blender a lot of users using 2.8 + was complaining of exporting objects that the material data was not being saved in the mtl file
it has something to do with the nodes set up in blender for the material . your right it is a pain wonder if they ever resolved it in 3.0 to convert the nodes to mtl
 
I use 3.0 ... so if it does do it automatically. i dont have it set up right. I rarly use blender anymore though cuz I switched to unreal. and recently got unity just to take my unreal and Sketchfab stuff into Unity to port to VaM. A lot of the apartments from sketchfab have planes on the windows with a background image stuck on it. Ive been taking off that plane so when the image is imorted back to vam, The HDR world lighting can be seen from inside.
 
Hi. Bit confused how to apply custom textures to Unity created assets.
Can apply them in Blender, when go to save them in Unity, it seems to just convert the form in FBX format.
When you bring a FBX in to Unity you need to extract the materials from the object. From there, you can select the different objects and change the Diffuse/Normal/Opacity (in the dropdowns) and the other parts of the texture depending on shader type you assign.
 
When you bring a FBX in to Unity you need to extract the materials from the object. From there, you can select the different objects and change the Diffuse/Normal/Opacity (in the dropdowns) and the other parts of the texture depending on shader type you assign.
In my experience, I've use blender mostly for conversions and morphing a .obj creating UVS, and texturing them with PS/DAZ Studio and Substance Painter (check out zonegfx for some software ideas) ... might be doing wrong, but that works for me
 
In my experience, I've use blender mostly for conversions and morphing a .obj creating UVS, and texturing them with PS/DAZ Studio and Substance Painter (check out zonegfx for some software ideas) ... might be doing wrong, but that works for me
thanks for the input
your right it is important to extract the material from the obj or fbx in order to use them in unity

yeah the substance painter does a better job than blenders texture paint , your method gives better results

with blender using FBX and OBJ can be a pain , as exporting an FBX or OBJ it loses the material data for textures
so when importing them in to unity all you will get is the material name and end up manualy dropping the textures back on to each material
not ideal if you have lots of textures .
would be nice if blender had some material presets that you can transfer the nodes to the correct one
or if someone has created a plugin to resolve it.

maybe you should create a quick tutorial on materials with extracting and adding textures in unity
be a useful addition.
 
Last edited:
maybe you should create a quick tutorial on materials with extracting and adding textures in unity
be a useful addition.

I think i can handle that, i've created everything from new objects, rooms, and people, and have gotten pretty proficient at it. I usually have blender, substance painter, photoshop, daz3d all open at once, going back and forth.
 
I think i can handle that, i've created everything from new objects, rooms, and people, and have gotten pretty proficient at it. I usually have blender, substance painter, photoshop, daz3d all open at once, going back and forth.
yeah i am the same as sometimes i like end up in unity see the thing i'm working on
and then oops that don't look right then jump back to blender, fix this and fix that , its the only way to get things done.
 
Seems everytime is start it lol, my ADHD kicks in, i'll get it sooner or later if i'm not beat to it
 
Seems everytime is start it lol, my ADHD kicks in, i'll get it sooner or later if i'm not beat to it
Oh sorry to hear that mate , i have occipital neuralgia and can be difficult to hold an interest in something .
im at the moment doing another apartment ,i have to do a bit and leave it ,then come back to it another day.
 
Hello, I was wondering if you might be able to help me import a baked emissive lightmap for a room? I have built the assetbundle, with the prefab and lighting data (I have tried with and without the light probe group and reflection probe inside the prefab) I have also copied the lighting data over, but Inside vam there is still no baked lightmap, even with "import lightmaps" box ticked in CUA menu, any help would be really apreciated, thanks <3
 
Oh sorry to hear that mate , i have occipital neuralgia and can be difficult to hold an interest in something .
im at the moment doing another apartment ,i have to do a bit and leave it ,then come back to it another day.
it's ok, ADHD, is great in the server field, i get all the main shit fixed, lose interest and give the 'cleanup' tasks to someone else, sell it like its something fun to do, but they get stuck with the paperwork. I am dead awful completing paperwork. Obviously, that was like over year ago, and i never wrote anything.

There are some good blender export tools that help with the texture transfer.

@Teapot
Hello, I was wondering if you might be able to help me import a baked emissive lightmap for a room? I have built the assetbundle, with the prefab and lighting data (I have tried with and without the light probe group and reflection probe inside the prefab) I have also copied the lighting data over, but Inside vam there is still no baked lightmap, even with "import lightmaps" box ticked in CUA menu, any help would be really apreciated, thanks <3
As far as baked light maps, i seldom do them, i haven't ever gotten one to work as expected, i get frustrated, yank the lights out, then try and re-create the lighting in VAM. If i could create/save/store an asset with the light map, and have it apply to other objects within vam when imported, that would be great, you can achieve pretty good lighting in Unity (be even better if VAM wasn't limited to the really old versin of unity too)
 
it's ok, ADHD, is great in the server field, i get all the main shit fixed, lose interest and give the 'cleanup' tasks to someone else, sell it like its something fun to do, but they get stuck with the paperwork. I am dead awful completing paperwork. Obviously, that was like over year ago, and i never wrote anything.

There are some good blender export tools that help with the texture transfer.

@Teapot

As far as baked light maps, i seldom do them, i haven't ever gotten one to work as expected, i get frustrated, yank the lights out, then try and re-create the lighting in VAM. If i could create/save/store an asset with the light map, and have it apply to other objects within vam when imported, that would be great, you can achieve pretty good lighting in Unity (be even better if VAM wasn't limited to the really old versin of unity too)
Hello AWWalker, love your work <3

I have since figured this out and it's super simple I can't believe I didn't notice. I came back to say as much to @VamTastic , thanks anyway <3 lol
I too have been frustrated about baked lighting, I did the same work around using VaM lighting but the impact on FPS is way too much.
So i set myself on a crusade to figure it out as i have seen other scenes with baked lighting and new it was possible :D

So all you need to do is bake your lighting and then drag over the actual saved scene file into the assetbuilder and let it create a new folder in the assetbuilder, you can change the name etc.
In my case, I wanted to bake emissive lighting for a neon glow effect and I'm happy with the result, and any attempts at baking realtime lighting seem to be overwritten by VaM Lights, shadows disappear etc.
This baked lightmap casts no shadows on Atoms or CUA's though, so in this image i have added a light in the center of my neon, and a light in the center of the larger room :D

Glow effect looks awesome :D rubbing my hands together like an evil genius just thinking about the ideas I'm having :D haha


1704767052783.png
 
Hello AWWalker, love your work <3

I have since figured this out and it's super simple I can't believe I didn't notice. I came back to say as much to @VamTastic , thanks anyway <3 lol
I too have been frustrated about baked lighting, I did the same work around using VaM lighting but the impact on FPS is way too much.
So i set myself on a crusade to figure it out as i have seen other scenes with baked lighting and new it was possible :D

So all you need to do is bake your lighting and then drag over the actual saved scene file into the assetbuilder and let it create a new folder in the assetbuilder, you can change the name etc.
In my case, I wanted to bake emissive lighting for a neon glow effect and I'm happy with the result, and any attempts at baking realtime lighting seem to be overwritten by VaM Lights, shadows disappear etc.
This baked lightmap casts no shadows on Atoms or CUA's though, so in this image i have added a light in the center of my neon, and a light in the center of the larger room :D

Glow effect looks awesome :D rubbing my hands together like an evil genius just thinking about the ideas I'm having :D haha


View attachment 321879
Brilliant work teapot . i haven't tempted baked lighting yet ,from what you have achieved looks great
something i am going to have to look into, as it will help a lot in reducing workload on the CPU and give better frame rates.
 
Back
Top Bottom