Join Kelley Hecker for an in-depth discussion in this video Introducing the Enemy class, part of Scripting Unity with C#.
- We're now going to add some new assets to our project.…If you're starting from the exercise files,…instead of continuing from the previous video,…you'll also need to import the standard assets for Unity 4.6…like in Chapter 3.…In the Editor select Assets, Import Package, Custom Package.…Navigate to the New Assets folder in the Exercise Files,…and select the Enemy.unitypackage file.…This will import a script and a new prefab.…
In the Prefabs folder, drag the Enemy prefab into the scene.…Double-click to focus on it.…As you can see, it just looks like a box,…which isn't very interesting.…Let's use the Assets Store to find a more suitable mesh.…Open the Assets Store and search for stone frog.…Select the Stone Frog package by BagIdeaStudio.…Download and import it into your project.…
In the BagIdea folder, there is a Prefab folder…with three different colored enemies.…I'm going to drag the blue enemy into my scene.…Expand the Enemy object and find the Cube object.…Delete this and click Continue…to break the prefab connection.…
- Defining classes and variables
- Attaching scripts to objects
- Understanding MonoBehaviour class
- Using the Unity Scripting API
- Importing assets
- Using a singleton pattern to manage game state
- Creating an event
Skill Level Intermediate
Q: Why am I getting a script compile error when trying to load the exercise files?
A: This course was recorded in Unity 4.6, and Unity has since released Unity 5. There are two items to address for Unity 5 users.
Q: Why can't I see the Render Settings option in the Edit menu?
A: The Render Settings options have been moved in Unity 5. You can access them by going to the Window menu and choosing Lighting. In the window that loads, Render Settings can be found under the Scene tab.