Hi everyone,
I made to develop a piece of code where i try to put group of gameobject and show them into canvas.
The code is looks like this:
private void InitTalonCards()
{
float startPosition = 2.0f;
float multiplier = 1.15f;
foreach (var obj in _zingDealer.TalonCards)
{
GameObject gameObj = (GameObject)obj;
// Preparation to init is next
// Check later to scale svg. Probably we will have better sharpness.
gameObj.transform.localScale = new Vector3(0.3f, 0.3f);
gameObj.transform.localPosition = new Vector3 (startPosition * multiplier - 6.80f, 2.5f, -1.0f);
GameObject firstDeck = (GameObject)Instantiate(gameObj, new Vector3(0, 0, 0),Quaternion.identity);
firstDeck.transform.SetParent(canvacesOfFirstDeck.transform, false);
multiplier += 1.15f;
// Instantiate(firstDeck);
}
}
At this point on run i can see in palliate the object are created and have proper values but the problem is on GUI it is not showing.
When i comment the code where i trying to put gameobjects in canvas and just to show them using the method Instantiate…It is showing on GUI but all of gameobjects are created globally and they not in certain canvas.
Thanks,
Nikola