- Home /
Instantiated GameObjects scale down based on screen size. (Mobile)
I have multiple GameObjects instantiating for my mobile game, and setting their transforms to a parent which has a scale of 1,1,1.
Unfortunately the game is completely made in Unity UI elements, don't ask why, but I think this may be part of the issue.
The issue lies in whenever I spawn an enemy, (which is a ui image) it will have a scale of 1,1,1 as a prefab, and on my mobile device, scales fine. However, on longer/larger devices the enemy instantiates much smaller comparatively to what it should be/is on my device.
I use the following to spawn my enemies (ui image barrels):
GameObject GO;
GO = Instantiate(prefabToSpawn[rBarrelSpawner], spawnLocation.transform.position, Quaternion.Euler(0,0,0)) as GameObject;
The canvas is set to screen space - overlay
The UI scale mode is scale with screen size
Screen Match Mode expand
Reference Resolution X 800 - Y 600
How can I fix this issue so the instantiated objects are the same across all devices?