Prefabs – How to make them, what they are for, and why!
Not sure where to put this question exactly, but prefabs seemed as good a place as any, please feel free to move it if you need to.
First of all congrats on the site! I’ve really started to enjoy my learning experience with Unity, as much as there’s tons of resource on their website, their tutorials feel like a toolbox of spanners chucked at your head, and it’s far too much for a relative newcomer to the 3D/games field.
However, i have a burning question which has also bothered me in other engines such as Unity, and that’s relating the size of objects and meshes to real-world objects and to each other.
That is, when you create a sphere or square it gets set up by default as 1,1,1. What is 1,1,1 in terms of a unit of measurement? I know that from a view and perspective aspect, it’s all relative to the position of the viewing camera, but for instance, if i was designing a game level (perpective or isometric, 3rd person or “God” mode like game) that involved people and a number of buildings that needed to be proportional (making the assumption that a person’s height in real dimensions is 6 feet), is there a guideline or benchmark set of dimensions to start from that could comfortably represent the size of a person, in relation to streets of proportionally sized buildings?
Keep up the good work,
Hi Patrick, ideally you should work in meters. This question is asked often so you’re not alone – it is addressed fairly succinctly here-
So basically, figure out your unit size for a person in meter / cm and you’re away! Remember you can always change the size of things in the import settings if they don’t come in at the size you expected, just remember to keep all your modelling to the same scale and you’ll be fine.
All the best
Help! When I drop the prefab in it randomly assigns the object a location hundreds of metres different to either the prefab or the apparent drop position. I can locate it and move but it is a pain. Brilliant tutorials!
When you drag or add any type of object into a scene (like adding an empty gameobject), it will have a relative position based on the camera view (where it stands and where it is looking at) and the point in the scene you dragged it to.
Objects that are added to the hierarchy will get a position of (0,0,0), unless it is positioned differently in a 3D software package on export (say a 3D model is at (50,50,50) in 3dsmax/maya etc.)
Hope that explains it 🙂
Dropping it into the hierarchy works for me.
When I duplicate items via “duplicate” or via “prefab” then they are NOT stopping on the floor but dropping further into space… All setting are the same, don’t know really why. Any help for a beginner?
You won’t believe! Falling from y=4 worked! The previous height (y=20) was too big!
Same point: expanding thickness of the paddle also worked 🙂
Unity3D = amazing engine
I’m guessing that this is a discrete collision issue—when physics calculations are done in separate steps, this sort of “tunneling” behavior is possible. The other thing you could try is changing the item’s collision detection in the physics component from Discrete to Continuous. I’m just starting to learn Unity, but that’s what I would say from my previous experience with rigid-body engines.
Just saying for anyone else who has the same issue.
Select object, press ctrl+C, and then press ctrl+V… you have prefab, lol
A good part to add to this tutorial segment is how to unlink the object from the prefab settings.
Example: You add in several object to the game using a prefab. You, however, want to make changes to only one of them. By unlinking the object to the prefab you will be able to make unique changes, while copying the base information from the prefab object.
Hi John…..love ur tutorials…and as Patrick said, this is truly a site to get our wits into game engines and to really advance on it….
My question….pavement and repeated flooring (ie.tile mosaics), i am using unity as an architectural/interior design visualization tool and worked very nice so far with houses and small buildings….now i have a large landscape project…if i model all the tiles etc in 3dsmax i see a very high poly count, do prefabs help in any way if i were to just create one tile and duplicate it inside unity? and how do i overcome this problem of slow/jittering playback?
My PC is a dual core 3.2/ 4Gb Ram and 2Gb nvidia graphics card.
thanx for this excellent BOOKMARKED site..:)
@Mohdgasim You can alter a single prefab “clone” by selecting the object in the Scene or Hierarchy and then editing the properties in the Inspector. You will see the attribute you changed become bold. That means the change is only affect that object and none of the other prefabs.
Click here to cancel reply.
Beginner B28 – SendMessage() to Call External Functions
Beginner B27 – Using Time.timeScale to Pause
Beginner B26 – Using Mathf.Clamp to restrict values
Beginner B25 – GUI Texture & Mouse Events
Unity3D Student is proudly powered by WordPress ver.4.7 | Unity3Dstudent is an educational endeavor by Will Goldstone | All Content Copyright Will Goldstone 2010