SlideShare une entreprise Scribd logo
1  sur  50
Télécharger pour lire hors ligne
UnityScript
The Basics

WOODIWISS.ME

Freelance Web Developer & Lecturer
in the Winchester, Hampshire area.
ECMA
What/Who is ECMA?
•

European Computer Manufacturers Association.

•

Non-profit Standards Organisation.

•

Introducing ECMAScript!

WOODIWISS.ME
ECMAScript
Language

ECMAScript.es

Dialects
JavaScript.js
WOODIWISS.ME

ActionScript.as
ECMAScript
ToolKit

Dialects

JavaScript.js

WOODIWISS.ME
ECMAScript
ToolKit

Dialects

JavaScript.js

WOODIWISS.ME
ECMAScript

JavaScript.js
UnityScript.js

WOODIWISS.ME
Onward!
•

NewBehaviourScript.js

•

Basic starting point.

•

#pragma strict?

•

Start

•

Update

WOODIWISS.ME
WOODIWISS.ME
WOODIWISS.ME
WOODIWISS.ME
NewBehaviourScript.js

WOODIWISS.ME
NewBehaviourScript.js

WOODIWISS.ME
NewBehaviourScript.js

WOODIWISS.ME
Start()
•

gameObject = Cube

•

Start = run before first frame.
•

e.g set color, set size, set
position…

WOODIWISS.ME
Start()
•

gameObject = Cube

•

Start = run before first frame.
•

e.g set color, set size, set
position…

WOODIWISS.ME
Start()
•

gameObject = Cube

•

Start = run before first frame.
•

e.g set color, set size, set
position…

WOODIWISS.ME
Update

•

gameObject = Cube still.

•

Continually polling the code.
Each frame.

WOODIWISS.ME
Mono Madness
•

All scripts extend
MonoBehaviour.

•

Awake()

•

OnCollisionEnter()

•

FixedUpdate()

•

LOTS more base functions.

WOODIWISS.ME
User Created
Functions
Keeps your code DRY
!

D - on’t
R - epeat
Y - ourself

WOODIWISS.ME
User Created
Functions
Keeps your code DRY
!

D - on’t
R - epeat
Y - ourself

WOODIWISS.ME
User Created
Functions
Keeps your code DRY
!

D - on’t
R - epeat
Y - ourself

WOODIWISS.ME

Defined
User Created
Functions
Keeps your code DRY
!

D - on’t
R - epeat
Y - ourself

WOODIWISS.ME

Defined
User Created
Functions

Invoked

Keeps your code DRY
!

D - on’t
R - epeat
Y - ourself

WOODIWISS.ME

Defined
In more detail
WOODIWISS.ME
In more detail
WOODIWISS.ME
Define

In more detail
WOODIWISS.ME
Define

In more detail
WOODIWISS.ME
Call / Invoke

Define

In more detail
WOODIWISS.ME
Variables
What is a variable?
!

var playerHealth : int = 100;
!

var playerHealth : int;
playerHealth = 100;

WOODIWISS.ME
Basic Data Types
int - Number without decimal place.
float - Number with decimal place.
boolean - Truth value.
String - Text or words, numbers, some symbols.
Vector3 - X Y Z co-ordinates.
GameObject - Object that is present in the Unity Scene.

WOODIWISS.ME
Basic Data Types
int = 17;
float = 5.994;
boolean = true;
String = “Darren”;
Vector3(100,124,55);

// x, y, z

GameObject = GameObject.Find("Zombie");
WOODIWISS.ME
Casting
var fingersOnHand : int;
var playerHeight : float;
var powerupActive : boolean;
var playerName : String;
var playerStartLocation : Vector3;
var enemy : GameObject;
WOODIWISS.ME
Casting and Assigning
var playerAge : int = 17;
var playerHeight : float = 5.994;
var powerupActive : boolean = true;
var playerName : String = “Darren”;
var playerStartLocation = Vector3(0,0,0);
var enemy : GameObject;
enemy = GameObject.Find("Zombie");

WOODIWISS.ME
Arguments

•

First define required
parameters.

•

Specify arguments parsed to
function.

WOODIWISS.ME
Arguments

•

First define required
parameters.

•

Specify arguments parsed to
function.

WOODIWISS.ME
Arguments

•

First define required
parameters.

•

Specify arguments parsed to
function.

WOODIWISS.ME
More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Cube

More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Cube

More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Cube
1

More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Cube
1

More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Cube
1

More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Cube
1
cube

More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Cube
1

cube
cube

More arguments
It’s like bloody Eastenders in here.
WOODIWISS.ME
Links / Research
•

http://en.wikipedia.org/wiki/Ecma_International

•

http://en.wikipedia.org/wiki/ECMAScript

•

http://www.mono-project.com/What_is_Mono

•

docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.html

•

http://unity3d.com/learn/tutorials/modules/beginner/scripting

•

https://www.inkling.com/read/javascript-definitive-guide-david-flanagan-6th/chapter-8/function-arguments-and

•

http://www.sublimetext.com/

WOODIWISS.ME
Next Time
Scope / Operators / Statements …

WOODIWISS.ME

Freelance Web Developer & Lecturer
in the Winchester, Hampshire area.
Questions?

WOODIWISS.ME

Freelance Web Developer & Lecturer
in the Winchester, Hampshire area.

Contenu connexe

En vedette

technology3-javascript-basics
technology3-javascript-basicstechnology3-javascript-basics
technology3-javascript-basics
Darren Woodiwiss
 
Organization behaviours
Organization behavioursOrganization behaviours
Organization behaviours
Atta Afridi
 

En vedette (17)

Volunteerism Conference 2012
Volunteerism Conference 2012Volunteerism Conference 2012
Volunteerism Conference 2012
 
Khalifatil muzdalifah
Khalifatil muzdalifahKhalifatil muzdalifah
Khalifatil muzdalifah
 
青年TuPa月報。11月號
青年TuPa月報。11月號 青年TuPa月報。11月號
青年TuPa月報。11月號
 
Inf1
Inf1Inf1
Inf1
 
θρησκευτικα
θρησκευτικαθρησκευτικα
θρησκευτικα
 
technology3-javascript-basics
technology3-javascript-basicstechnology3-javascript-basics
technology3-javascript-basics
 
Omgaan met biologische agentia- FEBEM - Brugge 2012
Omgaan met biologische agentia- FEBEM - Brugge 2012Omgaan met biologische agentia- FEBEM - Brugge 2012
Omgaan met biologische agentia- FEBEM - Brugge 2012
 
Everything you always wanted to know about Finnish declensions but were afrai...
Everything you always wanted to know about Finnish declensions but were afrai...Everything you always wanted to know about Finnish declensions but were afrai...
Everything you always wanted to know about Finnish declensions but were afrai...
 
Organization behaviours
Organization behavioursOrganization behaviours
Organization behaviours
 
ISG_Pós Graduação
ISG_Pós GraduaçãoISG_Pós Graduação
ISG_Pós Graduação
 
Rangka Utama.PDF
Rangka Utama.PDFRangka Utama.PDF
Rangka Utama.PDF
 
12NA30002 & 12NA30018
12NA30002 & 12NA3001812NA30002 & 12NA30018
12NA30002 & 12NA30018
 
Apuntes como-instalar-wp
Apuntes como-instalar-wpApuntes como-instalar-wp
Apuntes como-instalar-wp
 
Nuevo presentación de microsoft power point
Nuevo presentación de microsoft power pointNuevo presentación de microsoft power point
Nuevo presentación de microsoft power point
 
Lean manufacturing techniques (1)
Lean manufacturing techniques (1)Lean manufacturing techniques (1)
Lean manufacturing techniques (1)
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Dampers
DampersDampers
Dampers
 

Similaire à unity-clinic2-unityscript-basics

Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
Thinkful
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
Remy Sharp
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
PL dream
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQuery
Jamshid Hashimi
 

Similaire à unity-clinic2-unityscript-basics (20)

What the web platform (and your app!) can learn from Node.js
What the web platform (and your app!) can learn from Node.jsWhat the web platform (and your app!) can learn from Node.js
What the web platform (and your app!) can learn from Node.js
 
Javascript and Jquery: The connection between
Javascript and Jquery: The connection betweenJavascript and Jquery: The connection between
Javascript and Jquery: The connection between
 
Stupid Canvas Tricks
Stupid Canvas TricksStupid Canvas Tricks
Stupid Canvas Tricks
 
Automatically Assessing Code Understandability: How Far Are We?
Automatically Assessing Code Understandability: How Far Are We?Automatically Assessing Code Understandability: How Far Are We?
Automatically Assessing Code Understandability: How Far Are We?
 
Game age ppt
Game age pptGame age ppt
Game age ppt
 
Where There's Money, There's Crime: Web-based Threats
Where There's Money, There's Crime: Web-based ThreatsWhere There's Money, There's Crime: Web-based Threats
Where There's Money, There's Crime: Web-based Threats
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
 
Browsers with Wings
Browsers with WingsBrowsers with Wings
Browsers with Wings
 
Rapid prototyping with ScriptableObjects
Rapid prototyping with ScriptableObjectsRapid prototyping with ScriptableObjects
Rapid prototyping with ScriptableObjects
 
Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Game dev 101 part 3
Game dev 101 part 3Game dev 101 part 3
Game dev 101 part 3
 
Ember.js Tokyo event 2014/09/22 (English)
Ember.js Tokyo event 2014/09/22 (English)Ember.js Tokyo event 2014/09/22 (English)
Ember.js Tokyo event 2014/09/22 (English)
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Marionette: the Backbone framework
Marionette: the Backbone frameworkMarionette: the Backbone framework
Marionette: the Backbone framework
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
 
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQuery
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

unity-clinic2-unityscript-basics