Canvas prefab


To start your first Drawing app project, the easiest thing to do is to use the Paintcraft prefab which is located at Assets/Paintcraft/Prefab folder.

Find this object in your project and drag it to the scene

canvas prefab

If you have a brand new scene you will get this structure

canvas instance

This object already contains necessary configs, but it won't work immediatly because we need to tell our canvas where we want to draw.

Page Config

Let's create a new Page config. This object will keep configuration just the size our canvas will be.

We'll create a new folder for this Assets/Configs

And then click right mouse button and select Create/PaintCraft/BlankPageConfig menu

canvas instance

And now let's provide several settings for this config. Select this config in the project window and adjust settings in the inspector

Unique Id       # (0) this settings must be unique across all pages inside your project
Size            # (1) Actual size of your result image (like 1920x1080)
  1. We use this id to store some settings like preview icon and other meta data
  2. It's not mandatory to have canvas the same size as the screen. so we can make it smaller or bigger as you wish.

Here is what we can get

blank page config

Apply new page config

Now you have a page config and you can use it with your canvas object

  1. Select Canvas object in hierarchy
    canvas object

  2. Link your page config to the Page Config property
    canvas pageconfig property

  3. You can also change default background color of your canvas in the same Canvas Controller component change Default BG Color. I'll use default gray color

Here you go. Now press play button and you will be able to draw on your screen

paintcraft first play

Back Next: Change Tools Button