Hi,
I’m at a loss to figure out why modifying the local scale of an instantiated GameObject does not work immediately after instantiating. Best way to explain (PrefabManager contains lists to my prefabs, it’s been thoroughly tested and has worked for months!):
This does not work, the scale changes are lost::
myPrefabModel = (GameObject)GameObject.Instantiate(PrefabManager.theEquipmentModels["modelName"]);
myPrefabModel.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
This works:: (the method is called as a Coroutine)
myPrefabModel = (GameObject)GameObject.Instantiate(PrefabManager.theEquipmentModels["modelName"]);
yield return new WaitForSeconds(1.5f);
myPrefabModel.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
It seems I have to wait a very long time (1.5 secs minimum) in order to be allowed to alter the scale. I would much rather be able to do it immediately, it’s not very pleasing aestethically!
Many thanks for the help to come,
Ben