- Home /
Set UI Image to render below Gameobject [Resolved]
Hi, is there a way to render a IU image below a normal gameobject prefab?
I have been looking at the forum and web but no luck.
I've tried setting the renderer layer to my Backgroud, but an error pops out saying:
MissingComponentException: There is no 'Renderer' attached to the "BalloneFrame" game object, but a script is trying to access it.
You probably need to add a Renderer to the game object "BalloneFrame". Or your script needs to check if the component is attached before using it
My code looks like:
public string renderLayer;
public int orderLayer;
void Start () {
CanvasRenderer renderer = gameObject.GetComponent<CanvasRenderer> ();
renderer.renderer.sortingLayerName = renderLayer;
renderer.renderer.sortingOrder = orderLayer;
}
I've try also with the UI.Image component.
Can someone please point me in the right direction.
Thanks in advance.
Answer by Kiwasi · Dec 10, 2014 at 02:52 AM
Make sure the canvas is world space. Then arrange the canvas to be behind the GameObject in the scene view.
Thank you, that works great.
I don't know how to mark it has resolved, but I change the title...
Your answer
Follow this Question
Related Questions
Text is in front of game object 1 Answer
render order/ multipass shaders (hidden surface shader path) 1 Answer
Orthographic camera rendering order not always working 2 Answers
Particle system rendering behind meshs/models 0 Answers
How to render projector in front of walls but behind player? 1 Answer