Question by
venediklee · Jan 29, 2018 at 12:29 PM ·
transformprefabbuild-errorscalelocalscale
function works script-wise; doesn't work visually(only in game)
Hi all;
I have a script for changing the size of my wall prefabs, which works in editor both visually and script-wise; However when i build the game even though it still works script-wise(iDebug.Log the size before and after changing the size) it does not work visually, any ideas why this happens?
here is my code for changing size:
public void NormalWall()
{
Debug.Log("1");
if (WallPrefab[0].transform.lossyScale.y==4)
{
Debug.Log("2");
for (int i = 0; i< WallPrefab.Length; i++)
{
Debug.Log("3");
Debug.Log(WallPrefab[i].transform.localScale.y);
WallPrefab[i].transform.localScale -= new Vector3(0, 2.5F, 0);
Debug.Log(WallPrefab[i].transform.localScale.y);
}
}
SceneManager.LoadScene(1);
}
And note that only one of my wall prefabs has a child (i.e a father)
Comment
Your answer
Follow this Question
Related Questions
Player Prefab scale automatically goes to 1 x 1 x 1 whereas I have set it to 0.48 x 0.48 x 0.48 1 Answer
objects of same parrent random scale/size(xy and z) 0 Answers
Saving default scale of an object c# 1 Answer
New input system and prefab position problem 1 Answer
Unity Mirror - Player prefab rotation not syncronised on client 0 Answers