Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 2

DownloadManual
Open PDF In BrowserView PDF
What is Scratch Card?
This is easy-to-use asset, which allows you to create scratch card objects. So all
you need it’s to add prefab to scene:
- ScratchCard.prefab
choose Main Camera, set Sprite to set your scratch object and Erase texture.
This works well on Personal and Pro Unity, suitable for WebGL, Standalone and
mobile platforms. And all this takes less then 1 mb on your drive.

Quick Start
As mentioned above, to create scratch object, add prefab «ScratchCard» from
«Assets/ScratchCard/Prefabs/ScratchCard.prefab», you need set Main Camera, Sprite
for scratching, Texture for Eraser and Scratch Surface will have behavior! That is all!

ScratchCardManager script
ScratchCardManager script creates and configures ScratchCard.
ScratchCardManager script has such parameters:
- Main Camera - it’s Main Camera of scene;
- RenderType - render type of scratch card: MeshRenderer, SpriteRenderer or
CanvasRenderer;
- ScratchSurfaceSprite - sprite for scratching;
- EraseTexture - texture for erasing (erasing brush);
- Card - reference to ScratchCard script;
- Progress - reference to EraseProgress script;
- MeshCard - reference to GameObject with MeshRenderer;
- SpriteCard - reference to GameObject with SpriteRenderer;
- ImageCard - reference to GameObject with Image;
After instantiate ScratchCard.prefab, you need set Main Camera,
CardType(optional), ScratchSurfaceSprite and EraseTexture.
ScratchCardManager script has such methods:
void Awake() - setting up the scratch card;
public void SetEraseTexture(Texture texture) - setting up the erase
texture for the scratch card;
public void ResetScratchCard() - reset scratch card.
Note that if you use Canvas, ScratchCardManager.ImageCard object must be
child of Canvas.

ScratchCard script
ScratchCard script creates and configures RenderTexture, and draws the quads
in RenderTexture. You can use SpriteRenderer, MeshRenderer or Image for scratch
effect.
ScratchCard script has such parameters:
- Main Camera - it’s Main Camera of scene;
- Surface - transform of Surface object, which can contain Render Component;
- RenderTextureQuality - quality(size) of RenderTexture texture: High, Medium, Low;
- Eraser - Material of Eraser(brush);
- Progress - Material of Progress;
- Scratch Surface - Material of Scratch Surface.
- Reset - Reset Scratch card to original state.

EraseProgress script
EraseProgress script creates and configures RenderTexture, and calculate
amount of 15x15 pixels alpha-channel from ScratchCard RenderTexture. Using this
script can affect on the performance of device.
ScratchCard script has such events:
public event ProgressHandler OnProgress; - invoke, when user scratch
surface;
public event ProgressHandler OnCompleted; - invoke, when user
complete scratch surface.

Multiply scratch cards
If you want to use a few scratch card at the same time, you need choose specific
Scratch Surface Material for ScratchCard script for each scratch card or set it to
«None» - in that way, ScratchCardManager will create it automatically.

WebGL Build
By some reason, WebGL can ignore .shader and doesn’t add files into build. To
fix it, add shaders to Graphics Settings or move them to «Assets/Resources/» folder.

Please let me know if you have any questions.
E-mail: unitymedved@gmail.com



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
Page Count                      : 2
Title                           : Manual
Producer                        : Mac OS X 10.13.6 Quartz PDFContext
Creator                         : Pages
Create Date                     : 2019:05:27 21:48:04Z
Modify Date                     : 2019:05:27 21:48:04Z
EXIF Metadata provided by EXIF.tools

Navigation menu