Scratch To Unity: Looks

Beginner Scratch Tutorial Unity

This post provides a handy reference guide to go from Scratch’s “Looks” category of code blocks to C# with Unity.

khoanam3004TTTÍCH CỰC 4 phút Bác ưng em Mon này hông
Thursday September 10, 2020

Điện thoạiiPhone, iPad, iOS Khá ưng ý với kiểu này. Haha lamtien33823 phút Bình luận: 3 Khá ưng ý với kiểu này Haha 2 thích khoanam3004TT , 0967834589 thích nội dung này androidwindowsiostinhtefact 3 Bình luận Long Tại ThiênĐẠI BÀNG 7 phút Cơ mà nở bung hết rồi ???? MinhhuyclĐẠI BÀNG 4 phút HOA SẮP […]

The post khoanam3004TTTÍCH CỰC 4 phút Bác ưng em Mon này hông appeared first on Dua xe moto.

Code Blocks
Click on the picture of any of these Scratch code blocks to see how to write similar code statements in C#.

COM” Bảng xếp hạng Talking Tom hôn bạn gái
Thursday September 10, 2020

Game Talking Tom hôn bạn gái. Bạn đang chơi trò chơi Talking Tom hôn bạn gái là một game online hay tại chuyên mục Game Hoạt hình của Trò Chơi Việt. Hiện tại đang có cao thủ đang trực tuyến 24h chơi game vui này cày điểm và cùng vì nó quá hay. Thật khủng […]

The post COM” Bảng xếp hạng Talking Tom hôn bạn gái appeared first on Dua xe moto.

There is no direct equivalent to the “say” and “think” code blocks in Scratch. To create something similar, you will probably use Unity’s UI GameObjects. From the Hierarchy pane, click the “Create” button and then “UI” -> “Image” to create something which could display a picture of the speech or thought bubble (you will need to provide this asset yourself). Next, click the “Create” button and then “UI” -> “Text” to create a label where you can display your message.
To work with these UI components in code, you will need to add a using directive to your scripts:

using UnityEngine.UI;

And to program the delay between messages you can chain together coroutines like this:

lehmanbear Đô chỉ huy đồng tri
Tuesday September 08, 2020

Phim ảnh DC Extended Universe (DCEU). Thảo luận trong ”Phim ảnh” bắt đầu bởi yreimm0308n90, 4/5/15. Trang 2226 của 2226 trang

The post lehmanbear Đô chỉ huy đồng tri appeared first on Dua xe moto.

IEnumerator Say(string message, float seconds)
var label = GetComponent<Text>();
label.text = message;
yield return new WaitForSeconds(seconds);

In Unity, you would probably implement a Scratch Sprite (and its costumes) as well as backgrounds with a “SpriteRenderer” component. Suppose you have a reference to a sprite and a sprite renderer (you can connect them in code or in the Inspector pane):

public Sprite sprite;
public SpriteRenderer spriteRenderer;

Then you could set the sprite you want to display like this:

spriteRenderer.sprite = sprite;

You might also use an “Animator” component to play animations of sprite sequences. I enjoyed Unity’s “2D Roguelike” tutorial project for learning this work flow. Click here to watch. Of course there may be many more “up-to-date” tutorials available on their website now.

You use the “Transform” component of a GameObject to control its size. Values of ‘0’ to ‘1’ for each of the axis would equate to 0% to 100% of the size:

transform.localScale = new Vector3(1, 1, 1);

When dealing with sprites, you can set a tint color on the sprite renderer:

var spriteRenderer = GetComponent<SpriteRenderer>();
spriteRenderer.color =;

Most of the effects that Scratch exposes will also not have direct equivalents built-in to Unity. You can however obtain many effects by the use of something called shaders. You can find shaders on the Unity Asset Store. Even better, shaders can be applied even to 3D objects, not just simple sprites.

There are a few ways to show and hide your objects in Unity. You could turn on or off an entire GameObject which also disables all of its components and any children GameObjects in the hierarchy:

gameObject.SetActive(true); // Show
gameObject.SetActive(false); // Hide

Or, if you want other components to remain active and simply don’t want to “see” the object, then you can disable whichever component renders the object to the screen. In the case of a “Sprite” it could be a “SpriteRenderer” component:

var spriteRenderer = GetComponent<SpriteRenderer>();
spriteRenderer.enabled = true; // Show
spriteRenderer.enabled = false; // Hide

In some cases you can make one object appear in front of another simply by positioning it in 3D space. You might use the “Transform” to set the “Z” position for example. “Sprite” components also have the concept of layers as well as an order within a layer.

var spriteRenderer = GetComponent<SpriteRenderer>();
spriteRenderer.sortingLayerName = "Background";
spriteRenderer.sortingOrder = 3;

See Unity’s documentation for more.
This should cover all of the code blocks in Scratch’s “Looks” category. If you have any questions about this reference guide feel free to ask below.
If you find value in my blog, you can support its continued development by becoming my patron. Visit my Patreon page here. Thanks!