[Unity] Canvas Renderer

Discuss issues pertaining to the various game/web runtimes of Creature here.
Post Reply
firnind
Posts: 1
Joined: Sat Nov 17, 2018 3:15 pm

[Unity] Canvas Renderer

Post by firnind » Sat Nov 17, 2018 3:33 pm

Hi,

Canvas renderer works great. But is there a way to control how the character stretches based on screen aspect and resolution? For example i need that my character always fit in half of the screen on any resolution / aspect. Is there a way to acheve this?

In regular case (for images) one can use anchors / pivot points. But rect transform with creature renderer does not reflect any anchor changes except positioning. I tried this in Unity 5.5 and 2018.2.
So, do one should write his own script to calculate all the things to fit character (manipulating it's rect transform's local scale)?

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: [Unity] Canvas Renderer

Post by chong » Sat Nov 17, 2018 5:29 pm

Hello,

Yes you should write some basic C# code for that, that's why the runtime source is provided for you :)
In:
https://github.com/kestrelm/Creature_Un ... enderer.cs

I suggest looking at UpdateRenderingData(). In particular:

Code: Select all

active_mesh.vertices = vertices;

Those are the final render points of the character. You can apply any transform you want to them to get the intended result.


Thanks

Post Reply