4SearchingprefablightcameraparticlesystemterrainWord文档下载推荐.docx
《4SearchingprefablightcameraparticlesystemterrainWord文档下载推荐.docx》由会员分享,可在线阅读,更多相关《4SearchingprefablightcameraparticlesystemterrainWord文档下载推荐.docx(39页珍藏版)》请在冰豆网上搜索。
SceneViewandHierarchywithactivefilteringofsearchterm.
Whenasearchtermfilterisactive,theHierarchydoesn'
tshowhierarchicalrelationshipsbetweenGameObjects,butyoucanselectanyGameObject,andit'
shierarchicalpathinthescenewillbeshownatthebottomoftheHierarchy.
ClickonaGameObjectinthefilteredlisttoseeitshierarchicalpath.
Whenyouwanttoclearthesearchfilter,justclickthesmallcrossinthesearchfield.
IntheScenesearchyoucansearcheitherbyNameorbyType.Clickonthesmallmagnifyingglassinthesearchfieldtoopenthesearchdrop-downmenuandchoosethesearchmode.
SearchbyName,Type,orAll.
ProjectSearch
ThesamefundamentalsapplytosearchingofassetsintheProjectView--justtypeinyoursearchtermandyou'
llseealltherelevantassetsappearinthefilter.
IntheProjectsearchyoucansearchbyNameorbyTypeasintheScenesearch,andadditionallyyoucansearchbyLabel.Clickonthesmallmagnifyingglassinthesearchfieldtoopenthesearchdrop-downmenuandchoosethesearchmode.
SearchbyName,Type,Label,orAll.
ObjectPickerSeach
WhenassigninganobjectviatheObjectPicker,youcanalsotypeinanysearchtermsearchtofilterdowntoonlytheobjectsyouwanttosee.
●Prefabs
APrefabisatypeofasset--areusableGameObjectstoredinProjectView.Prefabscanbeinsertedintoanynumberofscenes,multipletimesperscene.WhenyouaddaPrefabtoascene,youcreateaninstanceofit.AllPrefabinstancesarelinkedtotheoriginalPrefabandareessentiallyclonesofit.Nomatterhowmanyinstancesexistinyourproject,whenyoumakeanychangestothePrefabyouwillseethechangeappliedtoallinstances.
CreatingPrefabs
InordertocreateaPrefab,youmustmakeanewblankPrefabusingthemenu.ThisblankPrefabcontainsnoGameObjects,andyoucannotcreateaninstanceofit.ThinkofanewPrefabasanemptycontainer,waitingtobefilledwithGameObjectdata.
Anew,emptyPrefab.ItcannotbeinstanceduntilyoufillitwithaGameObject.
TofillthePrefab,youuseaGameObjectthatyou'
vecreatedinthescene.
1.ChooseAssets->
Create->
PrefabfromthemenubarandnameyournewPrefab.
2.InHierarchyView,selecttheGameObjectyouwishtomakeintoaPrefab.
3.Drag&
droptheGameObjectfromtheHierarchyontothenewPrefabinProjectView.
Afteryouhaveperformedthesesteps,theGameObjectandallitschildrenhavebeencopiedintothePrefabdata.ThePrefabcannowbere-usedinmultipleinstances.TheoriginalGameObjectintheHierarchyhasnowbecomeaninstanceofthePrefab.
PrefabInstances
TocreateaPrefabinstanceinthecurrentscene,dragthePrefabfromtheProjectViewintotheSceneorHierarchyView.ThisinstanceislinkedtothePrefab,asdisplayedbythebluetextusedfortheirnameintheHierarchyView.
ThreeoftheseGameObjectsarelinkedtoPrefabs.Oneofthemisnot.
∙IfyouhaveselectedaPrefabinstance,andwanttomakeachangethataffectsallinstances,youcanclicktheSelectbuttonintheInspectortoselectthesourcePrefab.
∙InformationaboutinstantiatingprefabsfromscriptsisintheInstantiatingPrefabspage.
Inheritance
InheritancemeansthatwheneverthesourcePrefabchanges,thosechangesareappliedtoalllinkedGameObjects.Forexample,ifyouaddanewscripttoaPrefab,allofthelinkedGameObjectswillinstantlycontainthescriptaswell.However,itispossibletochangethepropertiesofasingleinstancewhilekeepingthelinkintact.Simplychangeanypropertyofaprefabinstance,andwatchasthevariablenamebecomesbold.Thevariableisnowoverridden.AlloverriddenpropertieswillnotbeaffectedbychangesinthesourcePrefab.
ThisallowsyoutomodifyPrefabinstancestomakethemuniquefromtheirsourcePrefabswithoutbreakingthePrefablink.
AlinkedGameObjectwithnooverridesenabled.
AlinkedGameObjectwithseveral(bold)overridesenabled.
∙IfyouwanttoupdatethesourcePrefabandallinstanceswiththenewoverriddenvalues,youcanclicktheApplybuttonintheInspector.
∙Ifyouwanttodiscardalloverridesonaparticularinstance,youcanclicktheRevertbutton.
BreakingandRestoringPrefabLinks
Therearecertainactionswhichwillbreakthelinkbetweenasingleinstanceanditssourceprefab,butthelinkcanalwaysberestored.Actionsthatwillbreakthelink:
∙AddingorremovingaComponent
∙AddingorremovingachildGameObject
Theseactionswillpromptawarning/confirmationmessageaboutbreakingthelink.ConfirmingtheactionwillbreakthelinksochangestothesourcePrefabwillnolongeraffectthebrokeninstance.Torestorethelink,youcanclickeithertheReconnectorApplybuttonsintheInspectoroftheinstance.
∙ReconnectwilldiscardalldifferencesfromthesourcePrefab.
∙ApplywillcopyalldifferencesintothesourcePrefab(andtherefore,allotherPrefabinstances)
ImportedPrefabs
WhenyouplaceameshassetintoyourAssetsfolder,UnityautomaticallyimportsthefileandgeneratessomethingthatlookssimilartoaPrefaboutofthemesh.ThisisnotactuallyaPrefab,itissimplytheassetfileitself.InstancingandworkingwithassetsintroducessomelimitationsthatarenotpresentwhenworkingwithnormalPrefabs.
NoticetheasseticonisabitdifferentfromthePrefabicons
TheassetisinstantiatedinthesceneasaGameObject,linkedtothesourceassetinsteadofanormalPrefab.ComponentscanbeaddedandremovedfromthisGameObjectasnormal.However,youcannotapplyanychangestotheassetitselfsincethiswouldadddatatotheassetfileitself!
Ifyou'
recreatingsomethingyouwanttore-use,youshouldmaketheassetinstanceintoaPrefabfollowingthestepslistedaboveunder"
CreatingPrefabs"
.
∙Whenyouhaveselectedaninstanceofanasset,theApplybuttonintheInspectorisreplacedwithanEditbutton.Clickingthisbuttonwilllaunchtheeditingapplicationforyourasset(e.g.MayaorMax).
●Lights
Lightsareanessentialpartofeveryscene.Whilemeshesandtexturesdefinetheshapeandlookofascene,lightsdefinethecolorandmoodofyour3Denvironment.You'
lllikelyworkwithmorethanonelightineachscene.Makingthemworktogetherrequiresalittlepracticebuttheresultscanbequiteamazing.
Asimple,two-lightsetup
LightscanbeaddedtoyourscenefromtheGameObject->
CreateOthermenu.Therearethreetypesoflightswhichwe'
lldiscussinamoment.Oncealighthasbeenadded,youcanmanipulateitlikeanyotherGameObject.Additionally,youcanaddaLightComponenttoanyselectedGameObjectbyusingComponent->
Rendering->
Light.
TherearemanydifferentoptionswithintheLightComponentintheInspector.
LightComponentpropertiesintheInspector
BysimplychangingtheColorofalight,youcangiveawholedifferentmoodtothescene.
Bright,sunnylights
Dark,medievallights
Spookynightlights
Thelightsyoucreatethiswayarerealtimelights-theirlightingiscalculatedeachframewhilethegameisrunning.Ifyouknowthelightwillnotchange,youcanmakeyourgamefasterandlookmuchbetterbyusingLightmapping.
Renderingpaths
UnitysupportsdifferentRenderingPaths,thesepathsaffectmainlyLightsandShadows,sochoosingthecorrectrenderingpathdependingonyourgamerequirementscanimproveyourproject'
sperformance.FormoreinfoaboutrenderingpathsyoucanvisittheRenderingpathssection.
Moreinformation
FormoreinformationaboutusingLights,checktheLightspageintheReferenceManual.
●Cameras
Justascamerasareusedinfilmstodisplaythestorytotheaudience,CamerasinUnityareusedtodisplaythegameworldtotheplayer.Youwillalwayshaveatleastonecamerainascene,butyoucanhavemorethanone.Multiplecamerascangiveyouatwo-playersplitscreenorcreateadvancedcustomeffects.Youcananimatecameras,orcontrolthemwithphysics.Practicallyanythingyoucanimagineispossiblewithcameras,andyoucanusetypicaloruniquecamerastofityourgame'
sstyle.
TheremainingtextisfromtheCameraComponentreferencepage.
Camera
Camerasarethedevicesthatcaptureanddisplaytheworldtotheplayer.Bycustomizingandmanipulatingcameras,youcanmakethepresentationofyourgametrulyunique.Youcanhaveanunlimitednumberofcamerasinascene.Theycanbesettorenderinanyorder,atanyplaceonthescreen,oronlycertainpartsofthescreen.
Unity'
sflexibleCameraobject
Properties
ClearFlags
Determineswhichpartsofthescreenwillbecleared.ThisishandywhenusingmultipleCamerastodrawdifferentgameelements.
Ba