8. Pros, cons?
• Cons:
• Less performant in general than a Unreal Engine
• More suited for « casual », cross-platform games (indie dev)
• Managed programming languages
9. Pros, cons?
• Pros:
• Portability!
• Easy to learn
• Make dev <-> graphists interactions easier
• Fast prototyping (no need to recompile everything to tune values)
• Unity Editor allows creation of house-made tools
• .NET power
• Services like Unity Purchasing making it easier to interface with common stores
10. How to code a Unity game?
• 2 langages :
• C# (.NET)
• JavaScript
• Unity Editor
11. Composition!
• In a Unity scene, everything is a GameObject
• A GameObject’s capabilities can be extended with components
• Script C# (« behaviors »)
• Transform (position, rotation, scale)
• Collider
• GUI element
• Camera
• …
12. Unity Editor & Scripts : basics
• Make the ball bounce on the board?
• Make the sphere react to clicks?
13. We won’t go far with that…
• What if we made an object that jumps when space is pressed, and that can
be virtually pushed by using the arrows?
Notes de l'éditeur
Montrer comment ajouter des composants : - Ouvrir ClickScale- Montrer un peu l’éditeur : liste des objets de la scène, hiérarchie des dossiers, et surtout INSPECTEUR- Tout gameobject a une Transform (position rotation scale) -> composant- Les objets peuvent avoir un nombre arbitraire de composants (voir la sphère : elle a un mesh, un collider, un renderer)
Rouvrir ClickScale
Mode play : se passe rien. Parce que la sphère n’a pas le composant qui l’enregistre dans le système de physics ! Ajoutons un RigidBody à cette sphère
Elle tombe !
Elle rebondit pas fort… Parce qu’on doit lui donner un PhysicMaterial.
Montrer que sans quitter le play, on peut bouger la sphère ou changer sa bounciness
- Les scripts sont eux-mêmes des composants ! Drag and drop l’attache.
you have to apply the force every fixed frame inside FixedUpdate instead of every frame inside Update. Between 2 frames, timing not guaranteed…