Cargando…

Learning C♯ by developing games with Unity 3D beginner's guide : learn the fundamentals of C♯ to create scripts for your GameObjects /

Chapter 2: Introducing the Building Blocks for Unity Scripts; Using the term method instead of function; Understanding what a variable does in a script; Naming a variable; A variable name is just a substitute for a value; Time for action - creating a variable and seeing how it works; Time for action...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Norton, Terry (Computer programmer)
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham : Packt Publishing, ©2013.
Temas:
Acceso en línea:Texto completo (Requiere registro previo con correo institucional)
Tabla de Contenidos:
  • Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Discovering Your Hidden Scripting Skills; Prerequisite knowledge for using this book; Dealing with scriptphobia; Teaching behaviors to GameObjects; Choosing to use C♯ instead of UnityScript; Reason 1 for choosing C♯
  • vast amount of documentation on the Internet; Reason 2 for choosing C♯
  • flexibility to use Unity scripts and regular C♯ code files; Reason 3 for choosing C♯
  • coding rules are specific; Maneuvering around Unity's documentation.
  • Time for action
  • opening the Reference Manual documentation for the transform ComponentTime for action
  • opening the scripting reference documentation for the transform component; Are we really supposed to know all that stuff?; What is all that information?; Working with C♯ script files; Time for action
  • create a C♯ script file; Introducing the MonoDevelop code editor; Syncing C♯ files between MonoDevelop and Unity; Time for action
  • opening LearningScript in MonoDevelop; Watching for a possible ""gotcha"" when creating script files in Unity; Fixing sync if it isn't working properly.
  • A more technical look at the magicEven more Unity magic; Components communicating using the Dot Syntax; What's with the dots?; Summary; Chapter 3: Getting into the Details of Variables; Writing C♯ statements properly; Understanding Component properties in Unity's Inspector; Variables become Component properties; Unity changes script and variable names slightly; Changing a property's value in the Inspector panel; Displaying public variables in the Inspector panel; Time for action
  • making a variable private; Naming your variables properly; Begin variable names with lowercase.
  • Using multi-word variable namesDeclaring a variable and its type; The most common built-in variable types; Time for action
  • assigning values while declaring the variable; Where you declare a variable is important; Variable scope
  • determining where a variable can be used; Summary; Chapter 4: Getting into the Details of Methods; Ending a method definition using curly braces; Using methods in a script; Naming methods properly; Begin method names with an uppercase letter; Using multi-word names for a method; Parentheses are part of the method name; Defining a method properly.