Prefabs in Unity work in a way that when you add one to a scene it creates an Instance of that object. All Prefab Instances are Linked to the Original Prefab and are essentially clones of it. You are able to change the properties of each Prefab (clone) But you always have the option to revert back to the original Prefab.
Prefabs Info: To be clear what a Prefab does, it Instances an Object. Each Object will still have to render each assets geometry. What the Prefab will do is “Call” The Material, Texture, Script and anything else connected to the original Prefab into the Engine once and each Prefab (Clone) Will use that. This means 1 prefab will only use 1 Draw call for Multiple Objects.
Creating Prefabs: Its very simple to create a Prefab. Make sure you have a Imported Model, .fbx or .obj will be fine. Then go to Assets/ Create/ Prefab. Name it what you want (I use a naming convention of “ObjectName_PREFAB”.
*Dont forget to create folders for all your different components such as Imports, Prefabs, Materials, Textures & Scripts*
There are 2 ways to connect your Imported Model to the new Prefab. If there in the same folder (I wouldn't recommend it) Drag & Drop, Or Drag your Import Into the ‘Hierarchy’, Navigate to the Prefab then Drag it from the Hierarchy to the Prefab. I like to delete the converted Import from the Hierarchy and start from the Prefab I created.
Draw Calls: Unity uses Draw Call Batching to call an Object from Memory to the screen. This is drawn from the Graphics API (e.g OpenGL or Direct3D)
Material Sharing using Prefabs and be batched together. also using Big Textures for multiple objects will result in less draw calls but use slightly more memory to draw the large texture size.
All devices and Platforms work with draw calls in mind, to run a scene with high performance it is good practice to keep your draw calls bellow the recommended platforms capabilities.
Static Batching: This allows the Engine to reduce draw calls provided the Object doesn't move (Static) this can be done by selecting your Prefab and Ticking Static in the Top Right Corner.
↧