Skip to content

Commit 1676f9e

Browse files
committed
simple readme
1 parent 6e21877 commit 1676f9e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Unity Parallax
2+
Скрипт для создания бесконечно прокручивающегося фона на Unity с эффектом параллакса из [статьи](https://suvitruf.ru/2019/12/23/7150/platformer-unity-background-parallax/).
3+
4+
## Использование
5+
Вся магия в скрипте [ParallaxScript.cs](https://github.com/Suvitruf/unity-parallax/blob/master/Assets/Scripts/ParallaxScript.cs).
6+
7+
Для начала вам нужно добавить на сцену 3 копии фона с отступами.
8+
![Create gameobjects](https://user-images.githubusercontent.com/1946939/71331732-7ccc7780-2544-11ea-986a-7091fdfc9d14.gif)
9+
10+
У вложенных объектов нужно выставить по координате X оффсет на размер спрайта. У одного с плюсом, а другого с минусом. В итоге корневой элемент будет по центру, а два вложенных по бокам.
11+
12+
![Backgrounds offset](https://user-images.githubusercontent.com/1946939/71331731-7ccc7780-2544-11ea-90fe-a4ace85f99f8.png)
13+
14+
Теперь нужно просто закинуть ParallaxScript.cs на корневой объект и добавить ссылку на камеру в редакторе. В итоге получим что-то такое.
15+
16+
![Фон с параллакс эфектом](https://user-images.githubusercontent.com/1946939/71331843-e2b8ff00-2544-11ea-9a27-cdff55bf5b28.gif)

README_ENG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Unity Parallax
2+
Script for creating 2d infinite scrolling background in Unity with parallax effect from [the article](https://suvitruf.ru/2019/12/23/7150/platformer-unity-background-parallax/).
3+
4+
## Usage
5+
All magic in the script [ParallaxScript.cs](https://github.com/Suvitruf/unity-parallax/blob/master/Assets/Scripts/ParallaxScript.cs).
6+
7+
First you need to add 3 copies of background with offset.
8+
![Create gameobjects](https://user-images.githubusercontent.com/1946939/71331732-7ccc7780-2544-11ea-986a-7091fdfc9d14.gif)
9+
10+
Nested objects should have offset by X axes. One with negative offset and one with positive. As a result root element will be in the middle, and 2 nested elements on the sides.
11+
12+
![Backgrounds offset](https://user-images.githubusercontent.com/1946939/71331731-7ccc7780-2544-11ea-90fe-a4ace85f99f8.png)
13+
14+
Now you just need to add ParallaxScript.cs to the root element and add ref to the camera in the Editor. And the result will look like this.
15+
16+
![Фон с параллакс эфектом](https://user-images.githubusercontent.com/1946939/71331843-e2b8ff00-2544-11ea-9a27-cdff55bf5b28.gif)

0 commit comments

Comments
 (0)