Instantiate a character sprite in a canvas

All about user interface, be it customizing built-in UIs or adding new ones.
Post Reply
juan.delcastillo
Posts: 30
Joined: 02 Feb 2021 19:11

Instantiate a character sprite in a canvas

Post by juan.delcastillo »

I'm currently creating a VN with 3D scenarios. When a character sprite spawns, since the main camera is on perspective, the sprite has a depth value and thus it doesn't necessarily spawns where it should (for example, it can't be seen because it spawns behind the scenario). This obviously doesn't happen with an ortographic camera but I'm currently working in a team and the designer wants the game to be on perspective mode

There are basically three cameras in the scene: the main camera (depth 1), the camera manager (depth 0) and the UI camera (depth 2). I've tried experimenting with camera depth but it doesn't solve anything, sorting canvas order has no effect either

It seems the only way to spawn it is an image component of a gameobject, that has to be a children of a canvas. Any tips?

Elringus
admin
Posts: 538
Joined: 11 May 2020 18:03

Re: Instantiate a character sprite in a canvas

Post by Elringus »

All the built-in char and back implementations except generic are drawing to render texture, which is then rendered by the main camera. If none of them suit your needs, you can create a custom one: https://naninovel.com/guide/custom-acto ... mentations. You can also try render to texture feature, which allows routing the render data to a custom texture, which you can then embed anywhere (eg, in a UI canvas): https://naninovel.com/guide/characters. ... to-texture

Post Reply