SlideShare a Scribd company logo
GenerativeArt–MadewithUnity
1
Technical Deep
Dive into the New
Prefab System
Steen Lund
Tech Lead, Unity Technologies
@steenlund
Agenda
2
● Prefab Assets, Instances and Content
● Prefab Importing
● Prefab Mode
● Unpacking
● Scripting and Tooling
Takeaway
3
● Knowledge of how the backend works
● Changes to Unity’s handling of Prefabs assets
● Knowledge of Prefab tooling in the Editor
Project Goals
4
5
Nested Prefabs
TableScene
Table
LegLeg
Table
VaseVase
Vase
Vase
6
Prefab Variants
CatScene
Cat
(instance
of Animal)
Cat Animal
Animal
Editing in isolation
7
Give some, take some
8
• No more disconnected Prefab instances
• No more editing directly in the Project Browser
Prefab Assets,
Instances and Content
9
10
GameObject
in scene
11
Make GameObject
into Prefab instance
12
Drag the GameObject
to Project Browser
13
What is a Prefab
14
Instance?
15
PrefabInstance
Handle
Instance
Leg
Table
More than you see with the
naked eye
16
corresponding object
Instance Asset
17
AssetInstance
Table
LegLeg
Table
18
Prefabs in Scene files
Main Camera
Directional Light
Scene File
PrefabInstance
Handle
Loaded Scene
PrefabInstance
Handle
What is a Prefab Asset?
19
Prefab File
Table
Leg
20
Consider a Prefab Asset being a scene
Prefab File
Table
Leg
PrefabInstance
Handle
Prefab Importing
21
22
Prefab File in Assets Folder
Prefab Importer
Table
Leg
Prefab File in Library Folder
Prefab Asset Handle
Table
Leg
23
Prefab File in Assets Folder Prefab File in Library Folder
Prefab Importer
Table
Leg
PrefabInstance
Handle
Prefab Asset Handle
Table
Leg
Vase
PrefabInstance
Handle
24
Prefab Variant File in Assets Folder Prefab File in Library Folder
Prefab Importer
PrefabInstance
Handle
Prefab Asset Handle
Vase
PrefabInstance
Handle
Corresponding Objects
With Nesting
25
Corresponding Objects with Nesting
26
Table
LegLeg
Table
VaseVase Vase
TableScene Vase
Corresponding Objects with Variants
27
CatCat Animal
CatScene Animal
28
Dependency chain
Prefab Importer Prefab Importer
Inner Middle Outer
29
Build size implications
● No change for Scene, have always been baked out at build time
● Resources and AssetBundles are affected
AA A
B C
30
PrefabAsset
Handle
PrefabInstance
Handle
Asset in Library FolderPrefab Instance
Table
LegLeg
Table
VaseVase
PrefabInstance
Handle
Prefab Mode
31
32
Edit Prefab
in Prefab Mode
Prefab Mode
Editing Prefab Asset
content

not Prefab instance
GameObject icon
not Prefab icon
Saving

not applying
33
34
Prefab
Asset
Prefab
instance
Prefab contents
in Prefab Mode
automatic
update
apply
open from instance
open from asset
save
Unpacking
35
36
Prefabs can no longer be disconnected
37
38
Make Prefab instance
into GameObject
Unpack Prefab Contents
(one layer)
39
Make Prefab instance
into GameObject
Unpack Prefab Contents
(one layer)
Prefab Variant
becomes its base
40
Scripting and Tooling
41
Editor Stages
42
• Main Stage
• Prefab Stage
• ….
Editor Stages
43
• [ExecuteInEditMode]
• Will leave Prefab Mode
• [ExecuteAlways]
Editor Stages: [ExecuteAlways]
44
void Update()
{
// Rotate only in playmode
// We don't want this in edit mode nor in prefab mode
// as it would update the prefab asset
if (Application.IsPlaying(this))
{
Transform t = GetComponent<Transform>();
t.Rotate(rotationSpeed * Time.deltaTime, 0, 0);
}
++updateCount;
Debug.Log(string.Format("Updates {0}", updateCount));
}
Case:
45
I want to dynamically create an editing
environment for my prefab
46
I want to dynamically create an editing
environment for my prefab
using UnityEditor.Experimental.SceneManagement;
[InitializeOnLoad]
class CustomPrefabEnvironment
{
static CustomPrefabEnvironment()
{
PrefabStage.prefabStageOpened += OnPrefabStageOpened;
}
static void OnPrefabStageOpened(PrefabStage prefabStage)
{
…
Case:
47
Is my GameObject a Prefab (and what kind)?
Is my GameObject a Prefab (and what kind)?
48
PrefabInstanceStatus GetPrefabInstanceStatus(Object componentOrGameObject)
PrefabAssetType GetPrefabAssetType(Object componentOrGameObject)
bool IsAnyPrefabInstanceRoot(GameObject gameObject)
bool IsOutermostPrefabInstanceRoot(GameObject gameObject)
bool IsPartOfAnyPrefab([Object componentOrGameObject)
bool IsPartOfImmutablePrefab(Object componentOrGameObject)
bool IsPartOfPrefabThatCanBeAppliedTo(Object componentOrGameObject)
bool IsPartOfPrefabAsset(Object componentOrGameObject)
bool IsPartOfPrefabInstance(Object componentOrGameObject)
bool IsPartOfNonAssetPrefabInstance(Object componentOrGameObject)
bool IsPartOfRegularPrefab(Object componentOrGameObject)
bool IsPartOfModelPrefab(Object componentOrGameObject)
bool IsPartOfVariantPrefab(Object componentOrGameObject)
bool IsDisconnectedFromPrefabAsset(Object componentOrGameObject)
bool IsPrefabAssetMissing(Object instanceComponentOrGameObject)
Is my GameObject a Prefab (and what kind)?
49
if (PrefabUtility.IsPartOfPrefabInstance(go))
{
var type = PrefabUtility.GetPrefabAssetType(go);
Debug.Log(string.Format("GameObject is part of a Prefab Instance of type {0}" ,type));
}
else
{
Debug.Log("Selected GameObject is not part of a Prefab Instance");
}
Case:
50
How do I know if 2 GameObjects are part of the
same Prefab Instance?
51
How do I know if 2 GameObjects are part of the same Prefab Instance?
var firstHandle = PrefabUtility.GetPrefabInstanceHandle(Selection.gameObjects[0]);
var secondHandle = PrefabUtility.GetPrefabInstanceHandle(Selection.gameObjects[1]);
if (firstHandle == secondHandle)
Debug.Log("GameObject belongs to same instance");
else
Debug.Log("GameObject are not from the same instance");
Case:
52
I want to create a Prefab from script
I want to create a Prefab from script
53
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
// If you simply want the cube to be written as an asset but not turn into a prefab instance
// use this method
PrefabUtility.SaveAsPrefabAsset(cube, path);
// This method will create a Prefab asset and make the GameObject an instance of the
// new prefab asset
PrefabUtility.SaveAsPrefabAssetAndConnect(cube, path, InteractionMode.AutomatedAction);
Case:
54
I want to create a Prefab Variant from script
I want to create a Prefab Variant from script
55
if (isAsset)
{
path = AssetDatabase.GetAssetPath(go);
go = (GameObject)PrefabUtility.InstantiatePrefab(go);
}
else if (isInstance)
{
go = PrefabUtility.GetOutermostPrefabInstanceRoot(go);
path = AssetDatabase.GetAssetPath(PrefabUtility.GetCorrespondingObjectFromSource(go));
}
var prefabName = System.IO.Path.GetFileNameWithoutExtension(path);
path = System.IO.Path.GetDirectoryName(path);
PrefabUtility.SaveAsPrefabAsset(go, path + "/" + prefabName + " Variant.prefab");
Case:
56
I want to nest Prefabs from script
57
I want to nest Prefabs from script
var instanceA = (GameObject)PrefabUtility.InstantiatePrefab(goA);
var instanceB = (GameObject)PrefabUtility.InstantiatePrefab(goB);
instanceB.GetComponent<Transform>().parent = instanceA.GetComponent<Transform>();
PrefabUtility.ApplyPrefabInstance(instanceA, InteractionMode.AutomatedAction);
58
I want to nest Prefabs from script
var instanceB = (GameObject)PrefabUtility.InstantiatePrefab(goB);
var root = PrefabUtility.LoadPrefabContents(path);
instanceB.GetComponent<Transform>().parent = root.GetComponent<Transform>();
PrefabUtility.SaveAsPrefabAsset(root, path);
PrefabUtility.UnloadPrefabContents(root);
Case:
59
I want to change a flag on multiple Prefabs assets
60
I want to change a flag on multiple Prefabs assets
// Load the content of the Prefab asset so we can modify it
var assetRoot = PrefabUtility.LoadPrefabContents(path);
GameObjectUtility.SetStaticEditorFlags(assetRoot, StaticEditorFlags.LightmapStatic);
// Write the updated GameObject to the Prefab asset
PrefabUtility.SaveAsPrefabAsset(assetRoot, path);
// Clean up is important or we will leak scenes and
// eventually run out of temporary scenes.
PrefabUtility.UnloadPrefabContents(assetRoot);
Case:
61
I want to add assets to my prefab file
AssetDatebase.AddObjectToAsset(newObject, asset);
Case:
62
Advanced: I modified a Library folder object,
now I want to update the source asset
63
Advanced: I modified a Library folder object,
now I want to update the source asset
string path = "Assets/Prefabs/A.prefab";
var goA = (GameObject)AssetDatabase.LoadMainAssetAtPath(path);
GameObjectUtility.SetStaticEditorFlags(goA, ~GameObjectUtility.GetStaticEditorFlags(goA));
PrefabUtility.SavePrefabAsset(goA);
64
Example code:
https://github.com/Unity-Technologies/UniteLA2018Examples
Scripting reference
https://docs.unity3d.com/2018.3/Documentation/ScriptReference/PrefabUtility.html
Prefabs landing page: https://unity3d.com/prefabs
Nikoline Høgh:
Oct. 24th 10 AM
Prefab Workflow Improvements – An Introduction
Location: Diamond 5
65
Questions?

More Related Content

What's hot

GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...Gerke Max Preussner
 
Practical SPU Programming in God of War III
Practical SPU Programming in God of War IIIPractical SPU Programming in God of War III
Practical SPU Programming in God of War IIISlide_N
 
Killzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo PostmortemKillzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo PostmortemGuerrilla
 
HDR Theory and practicce (JP)
HDR Theory and practicce (JP)HDR Theory and practicce (JP)
HDR Theory and practicce (JP)Hajime Uchimura
 
Optimizing Large Scenes in Unity
Optimizing Large Scenes in UnityOptimizing Large Scenes in Unity
Optimizing Large Scenes in UnityNoam Gat
 
전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017
전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017
전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017devCAT Studio, NEXON
 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenBenjamin Glatzel
 
「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発Unity Technologies Japan K.K.
 
Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019Unity Technologies
 
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile GamesUnreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile GamesEpic Games China
 
AAA게임_UI_최적화_및_빌드하기.pptx
AAA게임_UI_최적화_및_빌드하기.pptxAAA게임_UI_최적화_및_빌드하기.pptx
AAA게임_UI_최적화_및_빌드하기.pptxTonyCms
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Johan Andersson
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Guerrilla
 
Optimize your game with the Profile Analyzer - Unite Copenhagen 2019
Optimize your game with the Profile Analyzer - Unite Copenhagen 2019Optimize your game with the Profile Analyzer - Unite Copenhagen 2019
Optimize your game with the Profile Analyzer - Unite Copenhagen 2019Unity Technologies
 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lightingozlael ozlael
 
The Guerrilla Guide to Game Code
The Guerrilla Guide to Game CodeThe Guerrilla Guide to Game Code
The Guerrilla Guide to Game CodeGuerrilla
 

What's hot (20)

CEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらい
CEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらいCEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらい
CEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらい
 
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
 
Practical SPU Programming in God of War III
Practical SPU Programming in God of War IIIPractical SPU Programming in God of War III
Practical SPU Programming in God of War III
 
Killzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo PostmortemKillzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo Postmortem
 
HDR Theory and practicce (JP)
HDR Theory and practicce (JP)HDR Theory and practicce (JP)
HDR Theory and practicce (JP)
 
Optimizing Large Scenes in Unity
Optimizing Large Scenes in UnityOptimizing Large Scenes in Unity
Optimizing Large Scenes in Unity
 
전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017
전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017
전형규, 프로젝트DH의 절차적 애니메이션 시스템, NDC2017
 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the Fallen
 
Motion blur
Motion blurMotion blur
Motion blur
 
「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発
 
Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019
 
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile GamesUnreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
 
AAA게임_UI_최적화_및_빌드하기.pptx
AAA게임_UI_최적화_및_빌드하기.pptxAAA게임_UI_최적화_및_빌드하기.pptx
AAA게임_UI_최적화_및_빌드하기.pptx
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
 
Stochastic Screen-Space Reflections
Stochastic Screen-Space ReflectionsStochastic Screen-Space Reflections
Stochastic Screen-Space Reflections
 
Optimize your game with the Profile Analyzer - Unite Copenhagen 2019
Optimize your game with the Profile Analyzer - Unite Copenhagen 2019Optimize your game with the Profile Analyzer - Unite Copenhagen 2019
Optimize your game with the Profile Analyzer - Unite Copenhagen 2019
 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
 
The Guerrilla Guide to Game Code
The Guerrilla Guide to Game CodeThe Guerrilla Guide to Game Code
The Guerrilla Guide to Game Code
 
UE4 Ray Tracingによる リアルタイムコンテンツ制作
UE4 Ray Tracingによる リアルタイムコンテンツ制作UE4 Ray Tracingによる リアルタイムコンテンツ制作
UE4 Ray Tracingによる リアルタイムコンテンツ制作
 

Similar to Technical Deep Dive into the New Prefab System

Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript EverywherePascal Rettig
 
SharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSébastien Levert
 
Technical Deep Dive into the New Prefab System
Technical Deep Dive into the New Prefab SystemTechnical Deep Dive into the New Prefab System
Technical Deep Dive into the New Prefab SystemUnity Technologies
 
Django for IoT: From hackathon to production (DjangoCon US)
Django for IoT: From hackathon to production (DjangoCon US)Django for IoT: From hackathon to production (DjangoCon US)
Django for IoT: From hackathon to production (DjangoCon US)Anna Schneider
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Puppet
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
把鐵路開進視窗裡
把鐵路開進視窗裡把鐵路開進視窗裡
把鐵路開進視窗裡Wei Jen Lu
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
Vue JS @ MindDoc. The progressive road to online therapy
Vue JS @ MindDoc. The progressive road to online therapyVue JS @ MindDoc. The progressive road to online therapy
Vue JS @ MindDoc. The progressive road to online therapyDarío Blanco Iturriaga
 
Paver: the build tool you missed
Paver: the build tool you missedPaver: the build tool you missed
Paver: the build tool you missedalmadcz
 
Testing of javacript
Testing of javacriptTesting of javacript
Testing of javacriptLei Kang
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...DroidConTLV
 
Creating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartCreating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartDavid Keener
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 

Similar to Technical Deep Dive into the New Prefab System (20)

Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 
SharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure Functions
 
Technical Deep Dive into the New Prefab System
Technical Deep Dive into the New Prefab SystemTechnical Deep Dive into the New Prefab System
Technical Deep Dive into the New Prefab System
 
Soc research
Soc researchSoc research
Soc research
 
Gephi Toolkit Tutorial
Gephi Toolkit TutorialGephi Toolkit Tutorial
Gephi Toolkit Tutorial
 
Writing testable code
Writing testable codeWriting testable code
Writing testable code
 
Django for IoT: From hackathon to production (DjangoCon US)
Django for IoT: From hackathon to production (DjangoCon US)Django for IoT: From hackathon to production (DjangoCon US)
Django for IoT: From hackathon to production (DjangoCon US)
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
把鐵路開進視窗裡
把鐵路開進視窗裡把鐵路開進視窗裡
把鐵路開進視窗裡
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Vue JS @ MindDoc. The progressive road to online therapy
Vue JS @ MindDoc. The progressive road to online therapyVue JS @ MindDoc. The progressive road to online therapy
Vue JS @ MindDoc. The progressive road to online therapy
 
Paver: the build tool you missed
Paver: the build tool you missedPaver: the build tool you missed
Paver: the build tool you missed
 
Testing of javacript
Testing of javacriptTesting of javacript
Testing of javacript
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
 
Creating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartCreating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChart
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
React Native Firebase
React Native FirebaseReact Native Firebase
React Native Firebase
 

More from Unity Technologies

Build Immersive Worlds in Virtual Reality
Build Immersive Worlds  in Virtual RealityBuild Immersive Worlds  in Virtual Reality
Build Immersive Worlds in Virtual RealityUnity Technologies
 
Augmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real worldAugmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real worldUnity Technologies
 
Let’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and moreLet’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and moreUnity Technologies
 
Using synthetic data for computer vision model training
Using synthetic data for computer vision model trainingUsing synthetic data for computer vision model training
Using synthetic data for computer vision model trainingUnity Technologies
 
The Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global IndustriesThe Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global IndustriesUnity Technologies
 
Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games Unity Technologies
 
Unity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator ToolsUnity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator ToolsUnity Technologies
 
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...Unity Technologies
 
Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019Unity Technologies
 
Turn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiencesTurn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiencesUnity Technologies
 
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...Unity Technologies
 
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...Unity Technologies
 
QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019Unity Technologies
 
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...Unity Technologies
 
Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...Unity Technologies
 
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...Unity Technologies
 
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...Unity Technologies
 
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Unity Technologies
 
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019Unity Technologies
 
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019Unity Technologies
 

More from Unity Technologies (20)

Build Immersive Worlds in Virtual Reality
Build Immersive Worlds  in Virtual RealityBuild Immersive Worlds  in Virtual Reality
Build Immersive Worlds in Virtual Reality
 
Augmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real worldAugmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real world
 
Let’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and moreLet’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and more
 
Using synthetic data for computer vision model training
Using synthetic data for computer vision model trainingUsing synthetic data for computer vision model training
Using synthetic data for computer vision model training
 
The Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global IndustriesThe Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global Industries
 
Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games
 
Unity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator ToolsUnity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator Tools
 
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
 
Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019
 
Turn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiencesTurn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiences
 
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
 
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
 
QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019
 
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
 
Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...
 
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
 
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
 
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
 
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
 
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
 

Recently uploaded

Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfkalichargn70th171
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAlluxio, Inc.
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfOrtus Solutions, Corp
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationWave PLM
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILNatan Silnitsky
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfmbmh111980
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion Clinic
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 

Recently uploaded (20)

Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 

Technical Deep Dive into the New Prefab System

  • 1. GenerativeArt–MadewithUnity 1 Technical Deep Dive into the New Prefab System Steen Lund Tech Lead, Unity Technologies @steenlund
  • 2. Agenda 2 ● Prefab Assets, Instances and Content ● Prefab Importing ● Prefab Mode ● Unpacking ● Scripting and Tooling
  • 3. Takeaway 3 ● Knowledge of how the backend works ● Changes to Unity’s handling of Prefabs assets ● Knowledge of Prefab tooling in the Editor
  • 8. Give some, take some 8 • No more disconnected Prefab instances • No more editing directly in the Project Browser
  • 12. 12 Drag the GameObject to Project Browser
  • 13. 13
  • 14. What is a Prefab 14 Instance?
  • 18. 18 Prefabs in Scene files Main Camera Directional Light Scene File PrefabInstance Handle Loaded Scene PrefabInstance Handle
  • 19. What is a Prefab Asset? 19 Prefab File Table Leg
  • 20. 20 Consider a Prefab Asset being a scene Prefab File Table Leg PrefabInstance Handle
  • 22. 22 Prefab File in Assets Folder Prefab Importer Table Leg Prefab File in Library Folder Prefab Asset Handle Table Leg
  • 23. 23 Prefab File in Assets Folder Prefab File in Library Folder Prefab Importer Table Leg PrefabInstance Handle Prefab Asset Handle Table Leg Vase PrefabInstance Handle
  • 24. 24 Prefab Variant File in Assets Folder Prefab File in Library Folder Prefab Importer PrefabInstance Handle Prefab Asset Handle Vase PrefabInstance Handle
  • 26. Corresponding Objects with Nesting 26 Table LegLeg Table VaseVase Vase TableScene Vase
  • 27. Corresponding Objects with Variants 27 CatCat Animal CatScene Animal
  • 28. 28 Dependency chain Prefab Importer Prefab Importer Inner Middle Outer
  • 29. 29 Build size implications ● No change for Scene, have always been baked out at build time ● Resources and AssetBundles are affected AA A B C
  • 30. 30 PrefabAsset Handle PrefabInstance Handle Asset in Library FolderPrefab Instance Table LegLeg Table VaseVase PrefabInstance Handle
  • 33. Prefab Mode Editing Prefab Asset content
 not Prefab instance GameObject icon not Prefab icon Saving
 not applying 33
  • 34. 34 Prefab Asset Prefab instance Prefab contents in Prefab Mode automatic update apply open from instance open from asset save
  • 36. 36 Prefabs can no longer be disconnected
  • 37. 37
  • 38. 38 Make Prefab instance into GameObject Unpack Prefab Contents (one layer)
  • 39. 39 Make Prefab instance into GameObject Unpack Prefab Contents (one layer) Prefab Variant becomes its base
  • 40. 40
  • 42. Editor Stages 42 • Main Stage • Prefab Stage • ….
  • 43. Editor Stages 43 • [ExecuteInEditMode] • Will leave Prefab Mode • [ExecuteAlways]
  • 44. Editor Stages: [ExecuteAlways] 44 void Update() { // Rotate only in playmode // We don't want this in edit mode nor in prefab mode // as it would update the prefab asset if (Application.IsPlaying(this)) { Transform t = GetComponent<Transform>(); t.Rotate(rotationSpeed * Time.deltaTime, 0, 0); } ++updateCount; Debug.Log(string.Format("Updates {0}", updateCount)); }
  • 45. Case: 45 I want to dynamically create an editing environment for my prefab
  • 46. 46 I want to dynamically create an editing environment for my prefab using UnityEditor.Experimental.SceneManagement; [InitializeOnLoad] class CustomPrefabEnvironment { static CustomPrefabEnvironment() { PrefabStage.prefabStageOpened += OnPrefabStageOpened; } static void OnPrefabStageOpened(PrefabStage prefabStage) { …
  • 47. Case: 47 Is my GameObject a Prefab (and what kind)?
  • 48. Is my GameObject a Prefab (and what kind)? 48 PrefabInstanceStatus GetPrefabInstanceStatus(Object componentOrGameObject) PrefabAssetType GetPrefabAssetType(Object componentOrGameObject) bool IsAnyPrefabInstanceRoot(GameObject gameObject) bool IsOutermostPrefabInstanceRoot(GameObject gameObject) bool IsPartOfAnyPrefab([Object componentOrGameObject) bool IsPartOfImmutablePrefab(Object componentOrGameObject) bool IsPartOfPrefabThatCanBeAppliedTo(Object componentOrGameObject) bool IsPartOfPrefabAsset(Object componentOrGameObject) bool IsPartOfPrefabInstance(Object componentOrGameObject) bool IsPartOfNonAssetPrefabInstance(Object componentOrGameObject) bool IsPartOfRegularPrefab(Object componentOrGameObject) bool IsPartOfModelPrefab(Object componentOrGameObject) bool IsPartOfVariantPrefab(Object componentOrGameObject) bool IsDisconnectedFromPrefabAsset(Object componentOrGameObject) bool IsPrefabAssetMissing(Object instanceComponentOrGameObject)
  • 49. Is my GameObject a Prefab (and what kind)? 49 if (PrefabUtility.IsPartOfPrefabInstance(go)) { var type = PrefabUtility.GetPrefabAssetType(go); Debug.Log(string.Format("GameObject is part of a Prefab Instance of type {0}" ,type)); } else { Debug.Log("Selected GameObject is not part of a Prefab Instance"); }
  • 50. Case: 50 How do I know if 2 GameObjects are part of the same Prefab Instance?
  • 51. 51 How do I know if 2 GameObjects are part of the same Prefab Instance? var firstHandle = PrefabUtility.GetPrefabInstanceHandle(Selection.gameObjects[0]); var secondHandle = PrefabUtility.GetPrefabInstanceHandle(Selection.gameObjects[1]); if (firstHandle == secondHandle) Debug.Log("GameObject belongs to same instance"); else Debug.Log("GameObject are not from the same instance");
  • 52. Case: 52 I want to create a Prefab from script
  • 53. I want to create a Prefab from script 53 var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); // If you simply want the cube to be written as an asset but not turn into a prefab instance // use this method PrefabUtility.SaveAsPrefabAsset(cube, path); // This method will create a Prefab asset and make the GameObject an instance of the // new prefab asset PrefabUtility.SaveAsPrefabAssetAndConnect(cube, path, InteractionMode.AutomatedAction);
  • 54. Case: 54 I want to create a Prefab Variant from script
  • 55. I want to create a Prefab Variant from script 55 if (isAsset) { path = AssetDatabase.GetAssetPath(go); go = (GameObject)PrefabUtility.InstantiatePrefab(go); } else if (isInstance) { go = PrefabUtility.GetOutermostPrefabInstanceRoot(go); path = AssetDatabase.GetAssetPath(PrefabUtility.GetCorrespondingObjectFromSource(go)); } var prefabName = System.IO.Path.GetFileNameWithoutExtension(path); path = System.IO.Path.GetDirectoryName(path); PrefabUtility.SaveAsPrefabAsset(go, path + "/" + prefabName + " Variant.prefab");
  • 56. Case: 56 I want to nest Prefabs from script
  • 57. 57 I want to nest Prefabs from script var instanceA = (GameObject)PrefabUtility.InstantiatePrefab(goA); var instanceB = (GameObject)PrefabUtility.InstantiatePrefab(goB); instanceB.GetComponent<Transform>().parent = instanceA.GetComponent<Transform>(); PrefabUtility.ApplyPrefabInstance(instanceA, InteractionMode.AutomatedAction);
  • 58. 58 I want to nest Prefabs from script var instanceB = (GameObject)PrefabUtility.InstantiatePrefab(goB); var root = PrefabUtility.LoadPrefabContents(path); instanceB.GetComponent<Transform>().parent = root.GetComponent<Transform>(); PrefabUtility.SaveAsPrefabAsset(root, path); PrefabUtility.UnloadPrefabContents(root);
  • 59. Case: 59 I want to change a flag on multiple Prefabs assets
  • 60. 60 I want to change a flag on multiple Prefabs assets // Load the content of the Prefab asset so we can modify it var assetRoot = PrefabUtility.LoadPrefabContents(path); GameObjectUtility.SetStaticEditorFlags(assetRoot, StaticEditorFlags.LightmapStatic); // Write the updated GameObject to the Prefab asset PrefabUtility.SaveAsPrefabAsset(assetRoot, path); // Clean up is important or we will leak scenes and // eventually run out of temporary scenes. PrefabUtility.UnloadPrefabContents(assetRoot);
  • 61. Case: 61 I want to add assets to my prefab file AssetDatebase.AddObjectToAsset(newObject, asset);
  • 62. Case: 62 Advanced: I modified a Library folder object, now I want to update the source asset
  • 63. 63 Advanced: I modified a Library folder object, now I want to update the source asset string path = "Assets/Prefabs/A.prefab"; var goA = (GameObject)AssetDatabase.LoadMainAssetAtPath(path); GameObjectUtility.SetStaticEditorFlags(goA, ~GameObjectUtility.GetStaticEditorFlags(goA)); PrefabUtility.SavePrefabAsset(goA);
  • 64. 64 Example code: https://github.com/Unity-Technologies/UniteLA2018Examples Scripting reference https://docs.unity3d.com/2018.3/Documentation/ScriptReference/PrefabUtility.html Prefabs landing page: https://unity3d.com/prefabs Nikoline Høgh: Oct. 24th 10 AM Prefab Workflow Improvements – An Introduction Location: Diamond 5