Answer the question
In order to leave comments, you need to log in
I want to create a strip of xp when an enemy appears. I know how to do it in general, but there are problems?
I've been busy with Unity for a week.
When I create Image xp strips via script it is obviously not visible in the game. it is created without canvas.
How can I create an object and immediately put it into the canvas I need through the script?
Answer the question
In order to leave comments, you need to log in
I solved it like this
public GameObject myPrefab;
void Start(){
GameObject prefab = Instantiate(myPrefab , new Vector3(0,0,0), Quaternion.identity ) as GameObject;
prefab.transform.SetParent(GameObject.FindGameObjectWithTag("Пишем сюда тег канваса или другого объекта").transform, false)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question