Answer the question
In order to leave comments, you need to log in
How to spawn an object relative to Canvas, and also so that it would be higher in the hierarchy?
I want my object to always spawn relative to the Canvasa coordinates that I set for it when I change the screen resolution. And because I have prefabs spawning, I need them to spawn higher in the hierarchy than other objects
Answer the question
In order to leave comments, you need to log in
When creating an object via Instantive(); you can specify which object will be the parent object. You throw a prefab in the canvas script, and when creating the fourth variable, you specify cansvas.transform. Like this:
public GameObject obj;
public Vector3 vec;
public GameObject can
void Start(){
Instantive(obj, vec, Quaternion.identity, can.transform);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question