- Home /
Is there some sort of overhead when creating objects inside a canvas?
Is there some sort of overhead when creating objects inside a canvas? Like if I have a canvas on root object, and creating objects inside, that may/may not have canvas renderers, will it slow down something if objects do not really use that canvas?
Answer by dev-waqas · Jan 25, 2018 at 12:34 PM
It depends if they are static then Its not a problem but if you have many moving canvases then it can cause some lag on low end mobile devices. Don't worry about it before starting to make a game and if you game lags find the real cause of it using Unity profiler.
Thank for your answer!
Yes, moving elements in canvases will cause some lags. The question is that will objects, that are inside a canvas, but do not use it at all, will add some lags at all or they are ignored by canvas entirely?
Answer by victorbisaev · Jan 30, 2018 at 08:13 AM
If objects do not have "Canvas Renderers" they do not slow down rendering of the canvas. But as soon as the objects are part of internal Canvas objects' hierarchy, they slow down any manipulations with hierarchy like adding/removing objects inside Canvas.
Having a "container" object(s) inside Canvas (for example, to groups other objects with renderers) is OK as soon as it is not a 100-levels-nested hierarchy :)