2d urp unity что это
Перейти к содержимому

2d urp unity что это

  • автор:

2d urp unity что это

The following are 2D related features that utilize the Universal Render Pipeline(URP):

When using URP with the 2D Renderer selected, the Light 2D component introduces a way to apply 2D optimized lighting to Sprites.

You can choose from several different light types with the Light 2D component. The light types currently available in the package are:

The package includes the 2D Renderer Data Asset which contains the Blend Styles parameters, and allows you to create up to four custom Light Operations for your Project.

Note: If you have the experimental 2D Renderer enabled (menu: Graphics Settings > add the 2D Renderer Asset under Scriptable Render Pipeline Settings), some of the options related to 3D rendering in the URP Asset don’t have any impact on your final app or game.

Universal Render Pipeline

Universal Render Pipeline (URP) is a new rendering method introduced in Unity 2019.3.
URP replaces LWRP and supports more platforms and devices, and can be applied to various projects such as 2D, 3D, VR and AR.
We recommend that you refer to the following pages for further explanation.

Setting Up the Universal Render Pipeline and Changing Materials

Run «Window > Package Manager«.
(The location or name of the menu may vary depending on your version of Unity.)

(1) Select the «Universal RP» package.
If you don’t see the package in the list, it may take a while to load, so wait a moment.
(2) Press the Install button.

Once the URP package is installed, you need to create a Pipeline Asset and apply it to the rendering.
Right-click within the Assets folder or select from the Assets menu, and select «Create > Rendering > Universal Render Pipeline > Pipeline Asset (Forward Renderer)» .

«UniversalRenderPipelineAsset» is created.
Also «Default Renderer Asset» is created that defines how to render in URP.

Let’s apply the generated URP Asset to the project.
(1) Open «Edit > Project Settings» in the Unity Editor Menu and select the Graphics item.
(2) Assign the «UniversalRenderPipelineAsset» created above to the «Scriptable Render Pipeline Settings» item.
Now it’s rendered in URP, probably because most materials won’t render properly.

Let’s install and apply a material that supports URP.
(1) Open AnyPortrait Editor and select one of the Root Units.
(2) Press the Material Library button.
(3) Select the package you want to install. In this case, select the URP Presets package.
(4) With URP Presets selected, press the Unpack Preset button.

If you are using Unity 2021 or later, please install URP (2021) Presets added in AnyPortrait v1.3.5.
This preset includes all the functions of the existing URP presets and was developed for compatibility with Unity 2021.
Additional descriptions of these presets are located at the bottom of this page.

Once the package is installed, you need to run the Material Library again.
Press the OK button and press the Material Library button to open it again.

Three material presets with URP support have been added.
— URP Unlit : This is the material that renders the original color without lighting in URP environment.
— URP Lit : This is the material to which lighting is applied in URP environment.
— URP 2D Lit : This material is applied by 2D Light in URP environment with 2D Renderer.

Let’s create a material set with the added material presets.
(1) Press the Make Material Set button.
(2) Select one of the URP presets. In this step, select the URP Unlit preset.
(3) Press the Select button.

(1) Select the created URP Unlit material set.
(2) Press the Default Material button to set it as the default material.

Because clipping masks are rendered differently in LWRP and URP, you need to do additional work in Bake setup.
(1) Press the Bake button.
(2) Select the Setting tab.
(3) Change the value of the Render Pipeline item to «Scriptable Render Pipeline«.

(1) Select the Bake tab.
(2) Press the Bake button.

If you look at the character in the Unity scene, you can see that they now render correctly in the URP environment.

Applying URP Lit Material

You can apply URP Lit materials to make the character be rendered with lights.

Open the Material Library.
(1) Press the Make Material Set button.
(2) Select the «URP Lit» preset and (3) press the Select button.

(1) Select the created URP Lit material set.
(2) Press the Default Material button to set it as the default material.
When you’re done, close the Material Library.

Run Bake and see it in the Unity scene.

Unlike the Unlit material, the character will be a bit darker than the image above, or it will be black.
This is because Lit materials are dark without light.

Let’s add various kinds of Light objects.

When you run the game, you will see a lighted character.

Rendering in URP with the 2D Renderer

URP is a way to include the features of LWRP 2D.
You can simply apply the 2D Renderer to switch to the rendering method using 2D Lights.

Create a 2D Renderer asset.
Right click on the Assets menu or the Assets folder,
Select «Create > Rendering > Universal Renderer Pipeline > 2D Renderer (Experimental)«.

New 2D Renderer Asset (New 2D Renderer Data) is created.

(1) Select the «UniversalRenderPipelineAsset» created earlier.
(2) Assign «2D Renderer (New 2D Renderer Data)» to the items of the Renderer List.
(3) The lighting is not applied to the characters in the Unity scene since the material for the 2D Renderer has not yet been applied.
Let’s set up a material for URP 2D.

It is almost same to the method described above.
(1) Open the Material Library and press the Make Material Set button.
(2) This time, select «URP 2D Lit» preset and (3) press Select button.

(1) Select the created URP 2D Lit material set and (2) press the Default Material button to set it as the default material.

Run Bake and see it in the Unity scene.

As it is a Lit material, the character looks dark in a scene without light.
Currently basic Light objects are placed, but separate Light objects for the 2D Renderer are needed.

Add a 2D Light object.
In the «Light > 2D» category, there are 2D lights of the kind supported by the 2D Renderer.

Place 2D Lights to the scene.

You can see the beautifully rendered character in the URP 2D environment.

Shader Graph assets with URP support

When the URP Presets package is installed from the Material Library, shader assets that support URP are added as shown above.
(Assets > AnyPortrait > Assets > Shaders > Advanced folder)
These assets are created by Shader Graph.

Open these assets to see the contents of the Shader Graph.
Materials provided as presets only perform basic lighting.
Create your Shader Graph based on this asset and apply various rendering techniques.

Cautions for using URP materials

URP is a new feature introduced in the latest version of Unity 2019.3.
URP has many advantages in rendering, but there is a big problem with incompatibility.
Therefore, unlike the previous version of AnyPortrait, URP materials are provided in the form of Shader Graph.
However, please note the following limitations due to the limitation of the function of Shader Graph.

1) Soft Additive is not supported. Instead, Additive’s Shader also applies to Soft Additives.
2) Multiplicative method of mesh blend method is calculated as Multiply method, not 2X Multiply.
3) In URP 2D Lit, Additive (Soft Additive) and Multiplicative materials are not affected by light.

URP (2021) presets supporting Unity 2021 and newer versions

In Unity 2021 and earlier, many features of the URP were «experimental».
And starting with Unity 2021, some changes have been made as these become full features.
Unfortunately, due to this change, the existing URP material presets provided by AnyPortrait did not work properly.
Let’s solve the problem by using the «URP (2021)» preset added in AnyPortrait v1.3.5, and also use an additional material.
This material preset works in Unity 2021 and 2022.a.

The method of installing a new URP preset is the same as before.
(1) Open the Material Library.
(2) Click the list of preset packages.
(r) Select the «URP (2021) Presets«.

(1) With “URP (2021) Presets” selected, press the Unpack Preset button.
(2) An installation message appears. Press the Okay button.

If you open the material library again, you can see that the material presets included in URP (2021) are installed.
Each of the presets are as follows.
1. URP (2021) Unlit : A basic material that is not affected by light.
2. URP (2021) Lit : A material affected by light in URP’s default renderer.
3. URP (2021) Bumped Lit : A material to which normal maps (or bump maps) can be applied in URP’s default renderer.
4. URP (2021) 2D Lit : A material affected by light in URP’s 2D renderer.
5. URP (2021) 2D Bumped Lit : A material to which normal maps (or bump maps) can be applied in URP’s 2D renderer.
6. URP (2021) Mergeable Unlit : A unlit material that allows material merging in the URP.
7. URP (2021) Mergeable 2D Lit : A light-affected material that allows material merging in URP’s 2D renderer.

Note
For Mergeable presets, refer to the related page.

Most material presets behave almost identically to previous URP presets.
Unlit, Lit, 2D Lit Presets are the same as before.

If you have read the description above, the basic usage and materials added in the URP (2021) package are explained below.

First, let’s apply the Unlit material.
(1) Click the Make Material Set button.
(2) Select URP (2021) Unlit.

(1) Select the added Material Set.
(2) Press the Default Material button and set it to ON.

(1) Open the Bake dialog.
(2) Select the Setting tab.
(3) Change the value of the Render Pipeline option to Scriptable Render Pipeline.

(1) When all settings are complete, execute Bake.

As you can see above, it renders normally in the URP environment.

If you want to use a material affected by light rather than Unlit, you need to use a different material according to the Renderer like the previous version of the URP.
URP performs rendering by selecting one of the two types of Renderer as above.

We will explain how to use the newly added Bumped Lit material for each Renderer.
First of all, we will tell you how to use the Bumped Lit material in an environment using the 2D Renderer (aka URP 2D).

(1) Click the Make Material Set button.
(2) In the URP 2D environment, URP (2021) 2D Lit or URP (2021) 2D Bumped Lit can be used. In this page, we will use URP (2021 2D Bumped Lit).

(1) Select the added Material Set.
(2) Enable Default Material to ON.

This material set has an added attribute called «_BumpMap«.
(1) Assign normal maps for each image.

Bake and return to the Unity scene.
In order to check the normal map, we need to add a light.
(1) Right-click in Hierarchy.
(2) Light 2D objects are displayed in Light. First, let’s select Global Light 2D and add it.

(1) Select the added Light 2D and change the color.
(2) You can see the character is rendered to match the color of the light.

Next, let’s check the volume by the normal map.
(1) Add Spot Light 2D with directionality.

(1) Place the light and set the range and direction.
(2) Set the color of the light.
(3) Change the value of the Quality option of Normal Maps to Fast or Accurate.

You can see the character being rendered with volume by the normal map.

Let’s compare it with the rendering result of the 2D Lit material preset.
Depending on the material, you can see that the rendering result is different.

Next, let’s set the material in the environment where Universal Renderer is set instead of 2D Renderer.

(1) Click the Make Material Set button.
(2) URP (2021) Lit or URP (2021) Bumped Lit can be selected. Let’s select URP (2021) Bumped Lit here.

The rest of the process is the same.
Set the created material set as the default material, specify a normal map, and then execute Bake.

Unlike URP 2D, you can use the commonly used lights such as Directional Light or Point Light.
Please place the lights appropriately in the scene.

You can see the same rendering result with the normal map applied.

Create 2D Lights with Unity’s Universal Render Pipeline

Unity 2019.3 is packed to the brim with new features to help improve your game development process! Along with the release of a new graphics rendering pipeline called Universal Render Pipeline (formerly LWRP), there are a lot of new 2D aspects added in Unity 2019.3+, including 2D Worldbuilding tools, 2D PSD Importer, 2D Pixel Perfect package, and 2D lighting. With new features, comes new skills to learn though of course!

In this tutorial, we will specifically be looking at how to set up Unity using the Universal Render Pipeline (URP) and explore various properties of 2D lights in detail. In so doing, we will also set up our own 2D scene with various lights so that we can see URP in action! So, are you ready to learn how to light up your 2D game worlds?

Before we begin, please note that this tutorial is only applicable to Unity 2019.3 or later. If you’re using an older version of Unity, you will need to install a newer version.

Table of contents

Projects Files

You can download the project files for this tutorial here .

To use them, please follow the steps below:

  1. Unzip and open ‘Assets/Scenes/ExampleStart.scene‘.
  2. Download Painted HQ 2D Forest Medieval Background: https://assetstore.unity.com/packages/2d/environments/painted-hq-2d-forest-medieval-background-97738
  3. Follow Project Set-up Guideline
  4. Add the images from Painted HQ 2D Forest Medieval Background to your Sprites folder.

Python Blog Image

FINAL DAYS: Unlock coding courses in Unity, Unreal, Python, Godot and more.

TABLE OF CONTENTS

PROJECT SET-UP

The set-up process is not required if you’re using the example project. You can skip this section if you already know how to set up a universal render pipeline.

1. INSTALLING A UNIVERSAL RENDER PIPELINE

To create a new project that uses Universal Render Pipeline, open up the latest version of Unity Hub.

Go to Create > New Unity project > Choose ‘Universal RP Template’.

Creating a project with urp template

If you wish to add the Universal Render Pipeline to an existing project instead, you will need to install it from the package manager.

To do this, go to Package Manager > All Packages > Universal RP and make sure it is installed and up to date.

packagemanager_urp

2. CREATING A UNIVERSAL RENDER PIPELINE ASSET

Once you have installed the Universal Render Pipeline to your project, you can create a URP asset that is used to configure the pipeline.

To do this, right-click in the Project window. Select Create > Rendering > Universal Render Pipeline > Pipeline Asset

how to create urp pipeline asset

This asset can be used to control various graphical features and quality settings. When you click on ‘Pipeline Asset’, you will see that two asset files are automatically created:

  • UniversalRenderPipelineAsset.asset
  • UniversalRenderPipelineAsset_Renderer.asset

Note that the second asset (‘_Renderer’) is not needed as it will be replaced with a newly created 2D renderer after the next step.

3. ASSIGNING THE URP ASSET IN THE GRAPHICS SETTINGS

Creating a pipeline asset alone will not make our project use the URP straight away. We need to change the graphics settings by navigating to Edit > Project Settings > Graphics.

Within Graphics settings, you can drag and drop the UniversalRenderPipelineAsset into the Scriptable Render Pipeline Settings field.

Project settings-Graphics-Universal render pipeline

* Potential Issue *

After changing the graphics settings, some of the objects in your scene might turn pink. This is because some of the built-in shaders are not renderable by UniversalRP Materials.

To fix this issue, simply go to Edit > Render Pipeline > Universal Render Pipeline > Upgrade Project Materials to UniversalRP Materials.

(Note: This may take a while as Unity will attempt to update every single material in the Assets folder. Alternatively, you can manually select materials and upgrade the selected materials.)

Update Project Materials

4. CREATING AND ASSIGNING A 2D RENDERER DATA TO THE URP ASSET

Now the project is ready to use the Universal Render Pipeline, but we need to set up the URP asset first so that 2D lights can properly illuminate our scene. This can be done by creating a 2D Renderer Data by the same method we created the URP asset.

You can do so by right-clicking Project view and Create > Rendering > Universal Render Pipeline > 2D Renderer Data.

Once that is created, click on the UniversalRenderPipelineAsset that you created earlier. You can drag and drop the 2D Renderer Data into Renderer List in the Inspector, and set it to Default.

URP set 2d renderer default

2D LIGHTS AND SHADOWS

Congratulations! Now your project is all set up and ready to use 2D lightings. In this section, we will be looking at the various applications of 2D lights.

5. GLOBAL LIGHT

Your scene may have turned completely dark after the previous step. This is because the default (3D) light cannot illuminate our scene anymore.

We can light up the scene again by adding a 2D light to the scene. Click on any GameObject in the scene view, and go to ‘Add Component’ > Search ‘Light’ > Select ‘Light 2D (Experimental)‘.

Or alternatively, you can navigate to GameObject > Light > 2D.

Add 2D Light component

Note that 3D lights are not usable at this stage. Once you add a global light, your scene objects will be visible again.

Global Light On/Off comparison

  • Light Type (= Global light affects all rendered Sprites on all target sorting layers.)
  • Light Order (= Lower values are rendered first.)
  • Blend Style (= Determines the way light interacts with sprites.)
  • Color (= Use the color picker to change the color of light.)
  • Intensity (= Determines the brightness.)
  • Target Sorting Layers (= Determines which object can be affected by this light.)

We will leave most of these properties as a default state, but feel free to adjust the color and intensity to suit your taste.

6. PARAMETRIC LIGHT

Every object in the scene is faintly visible by the dim global light. Let’s create a Parametric light at the centre and make it look like moonlight by setting the properties as followings:

  • Sides: 5 → 48
  • Falloff: 0.5 → 6

Parametric light Moonlight

7. POINT LIGHT

Now, let’s add another light component on the bottom left of the screen. This time we will create a Point light and move it to the left bottom of the screen.

We will change the light properties as such:

  • Inner Angle: 15
  • Outer Ange: 90
  • Outer Radius: 22
  • Falloff Intensity: 0.8
  • Intensity: 6

The light has now become brighter and cone-shaped. We can copy and paste (Ctrl+C, Ctrl+V) this gameObject as many times as we want, assign an identical colour to each and arrange its position like a stage.

URP stage lights

8. NORMAL MAP

Normal Map is a texture that contains depth information of a surface. It can be used to create a more detailed shadow when lights reflect on the surface.

In this example project, we will apply a normal map to the mountain sprite.

You can create a normal map using a painting tool such as Photoshop, or using Normal Map Online. Link – https://cpetry.github.io/NormalMap-Online/

img 5e5badf92ec0e

  1. Select the mountain sprite (Assets > Sprites)
  2. Click on ‘Sprite Editor’ (If the button is disabled, check if you have installed ‘2D Sprite Editor’ from Package Manager.)
  3. Expand ‘Sprite Editor’ menu.
  4. Click on ‘Secondary Textures’.
  5. Drag and drop the corresponding normal map (Assets > Texture) to ‘Texture’.

Applying normal map as a secondary texture

Now, let’s hit ‘Apply’ in the Sprite Editor and see how it changed our mountain.

9. FREEFORM LIGHT

To see our normal maps in effect, we need to create a light that recognizes Normal Map.

Create a 2D light component, change its Light Type to Freeform, and tick the box next to Use Normal Map.

You can edit the shape of this light type in the scene view. Click on ‘Edit Shape’ button, and move the dot’s position with your mouse.

To add a dot, hover your mouse over a line of the shape and left-click. To remove a dot, select the dot and press ‘Delete’ on your keyboard.

We can clearly notice the difference between before and after using the normal map.

2D Freeform Light - Edit shape

10. ANIMATING THE 2D LIGHTS

The real beauty of lighting is when we start animating all these lights and change the static environment to a living world.

2D light and its properties can also be keyframed for animation as with any 2D sprites.

For example, we can create pulsing starlights in the sky simply by keyframing the intensity.

URP 2D Create a pulsing starlight

Copy and paste the star gameObject across the sky, change sizing and hit Play.

You will notice that all starlights are pulsing at the same time. You can randomize the starting point of each star’s animation, by attaching this script to each star gameObject:

Synchronized

Randomized

That’s it for this tutorial! As you can see, 2D Lighting has never been easier with the new Universal Render Pipeline update in 2019.3. Not only does it offer you immense customization in how you can light your scenes (and render your graphics in general), but it offers a user-friendly workflow for artists and non-artists alike. Of course, you can extend your skills far beyond what is covered in this tutorial for your own game projects, so feel free to experiment with the project and test your understanding

I hope you enjoyed this tutorial, and please let your imagination run wild in your games using the new 2D lighting feature for Unity. See you in the next post!

REFERENCE/LINKS

Painted HQ 2D Forest Medieval Background by Super Brutal Assets – https://assetstore.unity.com/packages/2d/environments/painted-hq-2d-forest-medieval-background-97738

Space Shooter Redux by Kenneys – https://www.kenney.nl/assets/space-shooter-redux

For further information about today’s contents, visit Unity’s Documentation page:

Разработка мобильных игр на Unity в современных реалиях. URP, 2D Animation и все-все все на примере игры

Всем привет! Это снова Илья и сегодня мы поговорим о технической реализации мобильной игры в современных реалиях. Статья не претендует на уникальность, однако в ней вы можете найти для себя что-то полезное. А чтобы рассмотреть разработку на реальном проекте — мы возьмем реализацию нашей игры, которая на днях выходит в Soft-Launch.

Итак, запасаемся кофе, открываем Unity и погнали!

Начнем с того, что мы работаем с URP (Universal Render Pipeline). Почему так? Потому что он проще в настройке и обладает более гибким контролем, чем стандартный рендер. Ну и добиться хорошей производительности на тапках исходя из этого — намного проще.

Стоит указать, что ниже пойдет речь о 2D игре. Для 3D игр подходы будут несколько отличаться, как и настройки.

Мы реализовали два уровня графики. Low Level — для деревянных смартфонов и High Level — для флагманов. Уровни графики подключаются при помощи Project Settings.

В нашем проекте стоят следующие настройки (для Quality уровней):

На что здесь следует обратить внимание:

  • Texture Quality — качество текстур. Для High — мы берем полный размер текстур, для Low — Четверть. Можно еще внести Middle пресет с дополнительным уровнем.
  • Resolution Scaling везде стоит 1 — мы берем это значение из URP Asset.
  • VSync на Low уровне стоит отключить.
  • Все что связано с реалтаймом — отключаем.

Теперь перейдем к настройкам самих URP Asset. На что следует обратить внимание:

Для разных уровней качества можно установить Render Scale — тем самым снижая разрешение для отрисовки. Также незабываем про Dynamic / Static батчинг.

Adaptive Performance

Отличная штука для автоматической подгонки производительности мобильных игр (в частности для Samsung-устройств):

Другие полезные настройки:

  • Отключите 3D освещение, лайтмапы, тени и все что с этим связано.
  • Используйте для сборки IL2CPP — ускорьте работу вашего кода.
  • Используйте Color Space — Linear.
  • По-возможности подключите multithreaded rendering.

Едем дальше. URP и другие настройки проекта сделали. Теперь настало время поговорить о нашем ядре проекта. Что оно включает в себя?

Само ядро фреймворка включает в себя:

  • Игровые менеджеры для управления состояниями игры, аудио, переводов, работы с сетью, аналитикой, рекламными интеграциями и прочим.
  • Базовые классы для интерфейсов (компоненты, базовые классы View).
  • Классы для работы с контентом, сетью, шифрованием и др.
  • Базовые классы для работы с логикой игры.
  • Базовые классы для персонажей и пр.
  • Утилитарные классы (Coroutine Provider, Unix Timestamp, Timed Event и пр.)

Зачем нужны менеджеры?

Они нужны нам для того, чтобы из контроллеров управлять состояниями и глобальными функциями (к примеру, аналитикой).

Хотя мы и используем внедрение зависимостей, менеджеры состояний реализованы в качестве синглтонов и могут быть (и по их назначению должны быть) инициализированы единожды. А дальше мы просто можем использовать их:

А уже сам менеджер распределяет, в какие системы аналитики, как и зачем мы отправляем эвент.

Базовые классы.

Здесь все просто. Они включают в себя базовую логику для наследования. К примеру, класс BaseView и его интерфейс:

А дальше мы можем использовать его, к примеру таким образом:

Классы для работы с контентом, сетью, шифрованием

Ну здесь все просто и очевидно. Вообще, у нас реализовано несколько классов:

1) Классы шифрования (Base64, MD5, AES и пр.)

2) FileReader — считывающий, записывающий файл, с учетом кодировки, шифрования и других параметров. Также он умеет сразу сериализовать / десериализовать объект в нужном формате и с нужным шифрованием.

3) Network-классы, которые позволяют удобно работать с HTTP-запросами, работать с бандлами / адрессаблс и др.

Утилитарные классы

Здесь у нас хранятся полезные штуки, вроде Unix Time конвертера, а также костыли (вроде Coroutine Provider-а).

Unix Time Converter:

Костыль Coroutine-Provider:

Наша игра — это по своей сути интерактивная история с различными мини-играми (поиск предметов, простенькие бои, крафтинг, найди пару, а также большое количество головоломок).

Каждая сцена — содержит в себе основной Installer, который помимо различных View, подключает логические блоки — своеобразные куски механик:

Эти куски механик последовательно выполняются, отдавая события OnInitialize, OnProgress, OnComplete. Когда последний блок сыграет свой OnComplete — он завершит работу сцены (закончит уровень).

Зачем это сделано?

  • Мы можем собирать каждую сцену из отдельных механик, как конструктор. Это может быть диалог -> поиск предметов -> катсцена -> поиск предметов -> диалог, или любой другой порядок.
  • Мы можем сохранять прогресс внутри сцены, привязываясь к определенному блоку.
  • Блоки механик удобнее изменять, нежели огромный инсталлер с кучей разных контроллеров.

При работе с контентом, мы стараемся делать упор на оптимизацию. В игре содержится много UI, скелетные 2D анимации, липсинк и прочее. Вообще, контента достаточно много, не смотря на простоту игры.

Анимации в игре

Самый удобный для нас вариант — оказался из коробки. Мы используем систему для работы с костной анимацией от самой Unity:

Да, можно взять Spine, но у нас нет настолько большого количества анимаций, поэтому вариант от Unity — весьма оптимален.

Упаковка и сжатие

Все, что можно и нужно запихнуть в атласы — мы запихиваем в атласы и сжимаем. Это могут быть элементы UI, иконки и многое другое. Для упаковки атласов — используем стандартный Unity пакер из Package Manager (V1):

Локализация

Вся локализация базируется на JSON. Мы планируем отказаться от этого в ближайшее время, но пока что на время Soft-Launch этого хватает:

Работа с UI

При работе с UI мы разбиваем каждый View под отдельный Canvas. 99% всех анимаций работает на проверенном временем DOTween и отлично оптимизирован.

View инициализируются и обновляются по запросу через эвенты, которые внедряются в Level Installer, либо в отдельных блоках логики.

Что мы используем еще?

  • Salsa — для липсинка;
  • 2D Lighting — для освещения. В большинстве сцен используется освещение по маске спрайта;
  • DOTween — для анимаций;

Работа с механиками получается достаточно гибкой за счет блоков логики, внедрение зависимостей — позволяет контролировать оптимизацию кода. У нас собственная реализация внедрения зависимостей, как и системы реактивных событий, дабы не громоздить Zenject + UniRX. Да, мы сделали проще, но нам и не нужно всех возможностей этих огромных библиотек.

Полезные ссылки:

Надеюсь, вам было полезно.

Готов ответить на все вопросы. 🙂

Ну кода тут кот наплакал. Скорее просто как пример

Подробнее скорее на хабр надо ��

Нихера не понятно , но очень интересно.

Дублирование кода детектед)

Рефактор мне в бухту ��

Главное не чистота, а рабочий результат)

DOTween — хорошая штука, но его "документация" — это пример того, как писать хэлпы нельзя. Там просто описание синтаксиса, без внятных ответов на вопросы "хочу X, когда Y" или "зачем для Z три разных механизма реализации".

Например, о том, что добавленный через визуальный редактор путь нельзя корректировать из скрипта в рантайме, мне удалось узнать только методом разбора исходников. Такие вещи в хороших домах объясняют.

Документация это тема для отдельного разбора. Хороший разработчик не всегда может хорошо написать доку ��

Отличная статья все по делу и ничего лишнего.

Спасибо за статью!

У вас перепутаны скриншоты с настройками Project Settings для Low и Quality.

а можно про URP на мобилках по подробнее? Какие крутые штуки он позволяет делать, недоступные обычному рендеру и при этом не убивает производительность?

У него более гибкая настройка и от него можно отнаследоваться для реализации своего пайплайна рендера.

Вот у меня и вопрос, что можно сделать им такое чего нельзя сделать простым рендером и при этом что бы мобила выдавала больше 2,5фпс?

Сравнительная таблица возможностей есть в Unity доках. А вообще, это просто более гибкий подход, где ты можешь вырубать на рендере то, что не нужно допустим на low-end девайсах и включать на hiend. Ну и универсальность конечно же.

Классно! Я в не-игровых программах на Unity почти также делаю 🙂 Только такую систему с блоками не реализовывал (но думал о подобном), т.к. у меня блоки работают не последовательно, а параллельно. )

Хм, про параллельные блоки я не думал, ибо для реализации геймплея это было бы не нужным.

Галка V sync для мобильных вроде как ни на что не влияет. Мобильные автоматически испольщуют vsync безальтернативно и частота экрана кратна 60/30/15 кадрам.

Я забыл приложить к этому скрипт, который позволяет работать с targetFramerate для насильного отключения на некоторых андроид девайсах

Про Salsa интересно поподробнее узнать. Там вроде чисто от от громкости звука разные blendshap-ы лица дёргаются (что уже выглядит неплохо), но мб вы как-то кастомно допиливали?

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *