加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 unity

unity.pdf

unity

kaychn
2012-02-25 0人阅读 举报 0 0 暂无简介

简介:本文档为《unitypdf》,可适用于IT/计算机领域

GameDevelopmentwithUnitybyPhilipChuTableofcontentsPublicationInformationOverviewGettingStartedInsideUnityWorkflowCollaborationAssetsScriptingCameraPhysicsGUINetworkingBrowserMacWidgetsWindowsMaciPhoneandiPodtouchWiiCopyright©Technicat,LLCAllrightsreservedPublicationInformationCopyright©byPhilipChuAllrightsreservedOverviewTechnicatdevelopsgamesundertheFuguGamesandHyperBowllabelsusingtheUnitygameengineThispageprovidessomegeneralinformationonusingthisengine,forinternalreference,guidelinesfordevelopmentpartners,andforanyoneelsewhomightfinditusefulNote:Thisinformationiscertainlynotbeuptodateorcomplete,orevenentirelyaccurateForthelatest,definitiveinformation,checktheUnitywebsitePlatformsUnityisamultiplatformDgameenginetargetedlargelyforindiedevelopersandcasualgames,althoughthescopeappearstobeexpandingPlatformsincludeMac(widget,browserandstandalone),Windows(browserandstandalone),iPhoneandWiiNotetheMacandWindowsversionarethesameproductGamesMadeSeetheUnitygamesonReddit,Unitygallery,andUnityforumsShowcaseandiPhonethreadsforexamplesofUnitymadegamesTheCompetitionThemostsimilarcompetitorsseemtobeTorqueandShivaSeethetoolspageforothergameenginesHowMuchUnityispricedat$fortheProversionandnowfreefortheIndieversion,whichismissingfeatureslikeDimageeffects,rendertotexture,video,assetstreaming,andrequiresthestandardUnitybadgeandloadscreenUnityiPhoneispricedsimilarlyfortheProversionandafewhundreddollarsfortheBasic,butalsorequirestheequivalentdesktopversionTheWiiversionismoreexpensive,at$kforindiedevelopersand$kfora"professional"developerpublisherAlllicensesareroyaltyfreeComparelicensesontheUnitylicenseGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedchartGettingStartedBackground•VisittheUnitysite•ReadtheUnitydocumentationInstallationDownloadUnityfromtheUnitydownloadpageLearnGothroughtheofficialtutorials,sampleprojectsandotheresourcesCheckoutthemanythirdpartytutorialsPerusetheUnitywikifortipsandcontributedcodeThat'sagreatplacetocontributeyourowncodeTheUnityDeveloperMagazineappearstobeawellreceived,ifsporadic,resourceTherearen'tasmanybooksonUnityasonTorqueandUnreal,butthereisUnityGameDevelopmentEssentialsFollowtheUnityblog(andcheckoutUnityuserblogs)Note:Dgamedevelopmentrequiresknowledgeofcontentcreation,programming,gamedesign,andDgraphicsconceptsIfyou'recreatingagameyourselfandnotplayingaspecializedroleinalargeteam,youcanprobablygetawaywithbeinganoviceatgamedesignandcontentcreation(makeabadgamewithstockassets),butyoucan'tgetawaywithoutknowledgeofDgraphicsandprogrammingMuchasI'dliketosayUnityisagreatwaytolearnitall,learningitallatonceisprobablytoomuchtoexpectYoushouldreaduponthebasics,first,beforejumpinginSeeGraphicsandGameDevelopmentforrecommendedreadingAskingQuestions•ReadtheSupportFAQ•AskspecificquestionsontheUnityanswerssite•ParticipateingeneraldiscussiontopicsontheUnityforumGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreserved•CheckoutUnityroadmap•ExploreotherUnityrelatedsitesReportingBugsIfyouhaveabugthatyouwantfixed,reportitviatheBugReporter(viaHelp>ReportaBugorfindtheBugReporterappintheUnityapplicationsfolder)SeetheUnityblogpostoneffectivelyreportingbugsYou'llgetanautomaticemailacknowledgmentwithalinktothenewentryintheUnitybugdatabaselikethisoneNote:GameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedTheentryisprivateinsofarasnoelsehastheURLuntilyoudiscloseit,butanyonewhohastheURLcanseeallofyourbugreportsRemovingthelastfourcharactersoftheURLwillleavealinkthatonlydisplaysthatspecificbugreportWhileyou'rewaiting,youcanalsoreporttheproblemandaskforworkaroundsorcommiserationontheappropriateUnityforum,butyou'llprobablygetareminderthatyoushouldreportitviathebugreporterRequestingFeauresForafeaturerequest,youhaveachoice:requestitusingthebugreporter,voteforitontheUnityfeedbackpageorpostitontheWishlistforumIfyoupostontheforumorreportitviathebugreporteryouwilllikelyreceivearecommendationtopostitonthefeedbacksite,butyourvotes(andthuspostingability)therearelimitedVotesarereplenishedwhenafeatureyouvotedforisimplementedInsideUnityTheWorldAccordingtoUnityBeforetalkingabouthowtodevelopagame,let'sdiscusswhat'sactuallyinagame,oratleast,agamebuiltwithUnityDIfyou'renewtoD,it'snotthatabigadeal,conceptuallyEveryone(Ihope)learnedalgebraandtrigonometrywiththeCartesianx,ycoordinatesystemDjustrequiresaddingazaxis,sowespecifypointsasx,y,zInUnity,byconvention,theyaxispointsupYoudon'thavetostickwiththisconvention,butitmakesthingseasierotherwiseyou'llhavetochangedefaultslikethedirectionofgravity,thedefaultorientationofcameras,etcAlsobyconvention,oneunitintheUnitycoordinatesystemequalsonemeterintherealworldTheoretically,youcouldmakeonUnitydistanceunitcorrespondtoanyreallifedistanceyouwant,butallthedefaultdistanceunitsinUnity(physicssettings,lightandcameranearfarplanes,shadowdistances)assumeoneUnityunitcorrespondstoonemeterSoinpractice,lifeisaloteasierifyoustickwiththatScenesAUnitygameconsistsofoneormorescenesInothergameengines,you'dcallthemlevelsGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreserved(infact,someUnityscriptfunctionsuse"level"intheirnames,butmoreonthatlater)GameObjectsAsceneconsistsof"gameobjects",oftenknownas"entities"inothergameenginesAgameobjecthasaname,positionandorientationinthesceneandotherattributesorbehaviordependingonwhattypeofobjectitrepresentsGameobjectscanhaveparentchildrelationshipsamongsteachotherThepositionandorientationofeachgameobjectisrelativetoitsparentThisisknownintheDgraphicsworldasascenegraph,(sotheterm"scene"makesense)Youcansketchoutthesegameobjectrelationshipsasagraph(ormorespecifically,atree,sinceit'sahierarchy)ParentingmakessenseforgameobjectsthatareconceptuallygroupedtogetherForexample,whenyoumoveacar,youwantthewheelstoautomaticallymovealongwiththecarSothewheelsshouldbespecifiedaschildrenofthecar,offsetfromthecenterofthecarWhenthewheelsturn,theyturnrelativetothecarClassesUnityisobjectorientedThatmeanseachobjecthasaclass,andeachclasscanderivefroma"base"or"parent"classAsanobjectorientedsystem,UnityhasaclasshierarchyThegameobjectclassderivesfromtheobjectclass,asdomanyotherclassesThistruncatedsnippetfromtheUnityScriptingReferenceclasshierarchyshowsaportionoftheclasshierarchydescendingfromGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedObjectComponentsManyearlyDsystemsusedinheritancetospecializethebehaviorofeachscenegraphnodeThiscouldresultinsomeawkwardnessintryingtodefineclassesthathandledeveryconceivablebehavioryou'dwantinasinglenodeAsareaction,"component"sytemshavebeenpopularrecentlyInUnity,forexample,eachnodeofthescenegraphisofoneclass,gameobject,andtospecifyitsbehavior,youattach"components"withthebehaviorsthatyouwantNoticeintheclasshierarchysnippetabovethatthereisaComponentclassderivedfromObjectAllUnitycomponentsaresubclassesofComponentorsubclassesofsubclassesofComponentForexample,Behaviour(notetheBritishspelling)isatypeofComponentthatcanbeenableddisabledHere'salistofallBehavioursGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedTherearemanyothertypesofcomponents,toomanytolisthereTheUnityScriptingReferencehastheentirelistOneadvantageofcomponentbasedgameenginesisthattheyareparticularlyamenabletodraganddropgamecreationuserinterfacesWanttoaddalighttoaparticularnodeinthescenehierarchySimplydragaLightcomponentontothatnodeYou'llseethat'sexactlyhowtheUnityEditorworksSoUnitycomponentsaredocumentednotonlyintheUnityScriptingReferencebutalsoinaComponentReference,andthedocumentationforeachcomponentallowshasalinkthatallowsyoutoswitchbetweendocumentationfortheScriptingusageandtheGUIusageintheUnityEditor,whichwe'llshowinthenextsectionWorkflowEditorNowthatweknowwhatwe'recreating,we'lltakeaquicklookatthecreationprocessUnitygamesarecreatedasprojectsintheUnityEditorTheEditordisplaysoneUnitysceneatatimeForexample,hereistheUnityEditorviewofHyperBowl,specifically,theintrologosceneGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedNote:SometimeswhenyouopenanexistingprojectwithUnity,itdoesn'tdisplayasceneeveniftheprojecthasexistingscenesDon'tpanicjustdoubleclickthesceneyouwanttotoopenTocreateagamewithUnity,thebasicstepsare:CreateaUnityprojectforthegameImportassetsCreateasceneforeachlevelIneachscene,selectandplaceassetsAdjustplacethemaincamera,addnewcamerasasdesiredAddlightobjects,adjustambientlightAddadjustmaterialstoobjectsGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedAttachphysicsmaterials,colliders,rigidbodiestoobjectsWriteandattchscriptstoobjectsTestrunintheEditorPublishtothedesiredplatformIteratively,ofcourseHierarchyThescenegraphforthissceneisintheHierarchypaneInspectorTheInspectorpanedisplaysattributesofthegameobjectselectedintheHierarchypaneThisincludesthegameobjectnameanditscomponentsWementionedeachgameobjecthasapositionandorientationThatisstoredintheGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedTransformcomponentWeseetheantennaalsohasameshfiltercomponent,whichcontainstheactualmeshdata,andameshrenderer,whichmakesitpossibletorenderthemesh,determinesinteractionwithshadows,andincludesmaterialsappliedtothemesh)ProjectTheProjectpaneliststheavailableassets,essentiallyapoolofprototypesyouusetoconstructyourHierarchyTechnically,youcouldprogrammaticallygenerateeverythinginyourgame(inotherwords,populatetheHierarchy)programmatically,buttypicallyyou'llGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreserveddragassetsfromtheProjectpaneintoyourHierarchypaneandthenmodifythecopyintheHierarchypaneasappopriateInotherwords,theProjectpaneshowswhatyoucanusetoconstructyourgameandtheHierarchypanedisplayswhatisactuallyinthegamePreviewTotestit,justhitthePlaybuttonScriptsarealsoattachedtogameobjectsascomponentsHereascriptisattachedtotheparentringsnodesolelyinordertorotatealltheringsWhenwehitPlay,we'llseetheringsrotateandalsoseetherotationvaluesintheringtransformupdateintheInspectorNotehowalltheobjectsinthehierarchybeneaththeparentringsnoderotatealongwithit,buttheglobe,whichisoutsidethathierarchy,doesn'tAgamewilltypicallyhavemorethanonescene,egmultiplelevelswithasceneforeachlevel,andmaybeanintroductorysceneliketheHyperBowllogosceneaboveHere'sthescenefortheHyperBowlClassiclaneGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedThelogoscenehasascripttotransitionfromthelogoscenetothebowlingscene,calledHyperStream,aswearetakingadvantageofthescenestreamingfeatureavailableforwebbuildsThescriptisattachedtoaDtextobjectsowecanconvenientlydisplaythestreamingprogressanda"hitentertocontinue"messagePublishFinally,wecanpublishthegameasawebplayerAsnotedabove,we'reusingthestreamingfeatureavailableinwebbuilds(sowhilethelogoisspinning,thenextlevelisloading)GameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedCollaborationVersionControlTheUnityEditorhasintegratedsupportfortheUnityAssetServertoprovideversioncontrolandworkgroupcollaborationforUnityprojectsThemetadataintheprojectLibrarydirectory,whichtrankstherelationshipsamongtheprojectAssets,doesn'tplaynicelywithothersourceversioncontrolsystemsUnityprovidessomeminimalsupportforthosesystemsbyoptionallymaintainingametadatafileforeachAssetfileThisoptioncanbeenabledintheEditorsettingsGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedTostartusinganexternalversioncontrolsystemwithUnity,followtheusingexternalversioncontrolinstructionsNote:Theexternalsourceversioncontrolsupportjustprovidescompatibilitywiththosesystems,notintegrationYou'llhavetoperformupdatesandcommitswiththeexternalsystemoutsideoftheUnityEditorDistributingProjectsEvenifyou'recreatingcontenttohandofftoaUnitydeveloperandnotusinganycollaborationtools,IhighlyrecommendyouimportyourassetsintoUnityanddeliverthemintheformofaUnityprojectfolderorUnitypackagefileThisallowsyoutoensuretheassetswillappearinUnityasintended,withthedesiredmaterials,shading,lighting,colliders,particlebehaviorasmuchcontrolasyouwanttoexertoverthefinalproductThegneralworkflowworkflowmightbe:ImportassetsintoaUnityprojectSetupcontrolscameraSetuptheappropriatematerialswithdesiredtexturesandshadersAnydefectsintheassets,reimport,repeatWhensatisfied,delivertheentireUnityproject,orexportasaunitypackagefileModelPreviewFinalizingtheartworkinUnityallowsyoutoinspectandverifyyourworkandalsomaintainthemostcontroloverthefinallookotherwiseyou'llhaveaprogrammerdecidingwhatGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedtexturesandmaterialparameterstouseIfyou'reprovidingtexturesforskyboxesandparticleeffects,whichneedtobeconstructedandviewedwithinUnity,thenit'sevenmoreimportantfortheartisttocompletetheworkwithinUnitysothere'snoconfusionoverhowtheassetsaretobeusedPreviewingamodelinUnityissimple,usingtheprovidedmouseorbitcamerascriptStartUnityandcreateanewproject(youcanreusethesameprojectoverandoverifyou'rejustusingittoinspectassetsImportyourassetasdescribedaboveDragtheassetintothesceneDragtheStandardAssetsScriptsCameraMouseOrbitscripttothemaincamerainthesceneSelectthecamera,andthendragtheassetinthesceneintothe"target"slotofthecamerascriptHitPlaytomouseorbitthecameraaroundtheassetAdjustthecamerascript"distance"attributeofthecamerascripttomovethecameracloserorfartherHere'saprojectinwhichIjustwantedtoseeifabadlyneglectedsketchgiventomeinhighschoolbyBerkeleyBreathedwouldmakeanicebumpmap(yeah,Imeanttoageandcrumpleit!)Iscannedthesketch,createdaUnityproject,importedthejpegofthesketchasatexture,createdacube,createdabumpmaterialwiththesketch,addedthemouseorbitscripttothecamera,andvoila!GameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedAnimationPreviewAudioPreviewFirstPersonScenePreviewArtistsanddesignersresponsibleforcreatingenvironmentsneedtoworkwithinUnityevenmoreBesidesplacingandtestingimportedassets,thedeveloperwillprobablyneedtocreateplacetestcameras,lights,terrain,skyboxes,physicssettings,allofwhichcanonlybeperformedintheUnityEditorTestinganenvironmentforafirstpersongameisnearlyassimpleaspreviewingasinglemodelInsteadofattachingacamerascripttothecamera,youjustdragafirstpersoncontrollerintothesceneGameDevelopmentwithUnityPageCopyright©Technicat,LLCAllrightsreservedStartUnityandcreateanewproject(youcanreusethesameprojectoverandoverifyou'rejustusingittoinspectassetsImportyourass

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/13

unity

仅供在线阅读

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利