Institute of Computer Science
  1. Courses
  2. 2023/24 fall
  3. Computer Game Development and Design (MTAT.03.263)
ET
Log in

Computer Game Development and Design 2023/24 fall

  • Main
  • Lectures
    • Homework-1
    • Homework-2
    • Homework-3
  • Labs
    • Lab1 Introduction to Unity
    • Lab2 Space Game part 1
    • Lab3 Space Game part 2
    • Lab4 Unity Components
    • Lab5 Project Setup
    • Lab6 Tower Defence
    • Lab7 Tower Defence GUI & Buildings
    • Lab8 Tower Defence Content
    • Lab9 Blender Tree
    • Lab10 Sounds
    • Lab11 Animations
    • Lab12 Level Design
    • Lab13 Editor Extensions
    • Lab14 Lighting
    • Lab15 Procedural Generation
  • Projects
    • Design Document
    • Peer Review
  • Links

Lab 13 - Extending the editor

Task:

Create an editor window or add property attributes to organize components in your projects. This task can be submitted as teamwork! - every member in the team will get the same points.

Score: 1 point

  • Each decorated component using property attributes adds 0.2p (at least 5 fields with annotations)
  • Custom inspector 1p
  • New editor window 1p
  • Scene tool (custom gizmos and such) 1p (please also submit a txt document that describes the scene tool behavior)

Your work should add up to at least 1 point. The system is quite generous, so don't feel limited by the score values. It is not possible to receive more than 1 point though.

Submission:

Create screenshots of your editor modifications. Since you are modifying your projects, then this task can be submitted as a team. Add a text file or comment with all the names!

Using Property Attributes

Property attributes take very little effort to use and offer a lot of benefits. Download the example code and add it into a Unity project.

Example: https://www.optimatica.eu/courses/AttributeExamples.cs

Defining a completely custom inspector view

Unity also supports completely changing the look of a MonoBehaviour or ScriptableObject inspector window. For this you have to:

  • Extend a new class from the Editor class for your custom inspector. eg public class MyComponentEditor : Editor
  • Mark the class with CustomEditor attribute. [CustomEditor(typeof(MyComponent))]
  • Define a OnInspectorGUI method using property drawers and IMGUI.

Examples: https://docs.unity3d.com/Manual/editor-CustomEditors.html

Video tutorials:

  • https://unity3d.com/learn/tutorials/topics/interface-essentials/building-custom-inspector

Adding new editor windows

You can create your own dockable windows inside the editor. This is useful for creating tools and plugins for your projects.

To create a window you must extend the EditorWindow class and define OnGUI method.

Manual: https://docs.unity3d.com/Manual/editor-EditorWindows.html

Scripting reference: https://docs.unity3d.com/ScriptReference/EditorWindow.html

Submission

If you did this task as a teamwork, only one person should submit. Add a text file with the names and everyone in the team will get the same points.

Make pictures (screenshots with the Snipping tool) of all your custom editor views (inspectors, windows), add a text file with the names and pack it to a zip file. Submit the zip.

13. Lab 13
Solutions for this task can no longer be submitted.
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment