Then drag TreeCircle from the Inspector onto the Tree Object field.Ĭlick Play to preview your new working animation. Select ScrollingTrees in the Hierarchy, click Add Component and select Scripts ▸ Animate Controller. Note: You can learn more about FixedUpdate in the official Unity docs. turnSpeed allows you to tweak how fast the trees rotate. This rotates the sprite assigned to the treeObject variable at a consistent speed, regardless of whether the player’s frame rate is 30 FPS, 60 FPS, or fluctuates in between. (new Vector3(0f, 0f, turnSpeed * Time.fixedDeltaTime))
#Microsoft pinball arcade intro code#
With the graphics in place, it’s time to add the script that controls the animation.ĭouble-click Assets/RW/Scripts/AnimateController to open it in your code editor.Īdd the following variables below the existing ones: From the Mask Interaction drop-down, select Visible Inside Mask. Using the Inspector, find the Sprite Renderer and select Efx from the Sorting Layer drop-down.
In the Inspector, go to the Sprite field of the Sprite Mask component, click on the circle icon to launch the list of sprite assets, and select trees_mask.Right-click ScrollingTrees in the Hierarchy, select 2D Object ▸ Sprite Mask and name it TreeMask.In the Inspector, set the Transform Position to (X:-0.7, Y:2.2, Z:0) and set its Rotation to (X:0 Y:0 Z:17).Go to Assets/RW/Sprites, drag trees_circle onto ScrollingTrees in the Hierarchy and name the sprite instance TreeCircle.Next, you’ll use a Sprite Mask to display only a part of an animation. Then use Control/Command-D to duplicate it six times! Then all that’s left is to rename each GameObject. Note: Create these GameObjects quickly by selecting the Interactive Parts GameObject and pressing Alt-Shift-N to create a child GameObject. Next, create seven more empty GameObjects as children of Interactive Parts and name them:īe sure to reset all their Transform values as well. In the Inspector, reset its Transform values by clicking the Settings icon and selecting Reset. Now, name the new object Interactive Parts. Now it’s time for the fun stuff: adding the action! Getting the Ball Rollingįirst, you need to create an empty GameObject to hold your work.ĭo this by right-clicking an empty space in the Hierarchy and selecting Create Empty. You’ll find that most of the nuts and bolts for the pinball game are already in the starter project. In the Sorting Layer drop-down, select Efx and click Play. Animations: Select Animations in the Hierarchy and click Add Component.In the newly-added Sorting Group component, find the Sorting Layer drop-down and select Panel. Then, click Add Component and select Rendering ▸ Sorting Group. To show this group, select Static Panel in the Hierarchy. Static panel: Contents in this group are hidden.Static colliders: These objects with colliders form the basic collision structure of the pinball table.Now, adjust your Sorting Layers as follows: The Sorting Layers in this project should be in the following order: That is, multiple instances of a prefab with multiple objects on different sorting layers. Adjusting Your Sorting LayersĪ Sorting Group is a group of components you use to create consolidated Sorting Layers. Your first task is to adjust the Sorting Layers for the last three groups so they render in the correct order. Well, things are certainly animating! But the images are currently fighting each other to render on-screen. In the Hierarchy, you can see the GameObjects separated into categories:Ĭlick Play and take a look at the current state of the pinball table. When the project launches, switch to the Scene view and make sure you’re using 2D mode.ĭouble-click the PinballWizard scene in Assets/RW/Scenes. Unzip the materials and open the starter project in Unity.
#Microsoft pinball arcade intro download#
Make sure you’re using Unity version 2019.3, which you can download through the Unity Hub. It’s time to get the (pin)ball rolling! Getting Startedįirst, download the starter project by clicking the Download Materials button at the top or bottom of the tutorial. Types of effectors and 2D physics materials.If you’re not, take the time to read through our Introduction to Unity UI tutorial first.īy the time you’ve finished this tutorial, you’ll know more about: Note: This tutorial assumes that you’re comfortable working with Unity and you know your way around Unity’s UI.