Just a bit more understanding around the need to Revert the Scale

Hi,
This is still a bit foggy as to the why we need to revert the scale.
So we create Tile (scale 1) → road straight(scale1) → road90(scale 1) so we have inherited the scale all the way from the parent (Tile) and have not overridden scale at any time in our prefab variants. Just the Y rotation on the transform. So I am confused why when you create a variant of a variant the scale breaks and we have to reset the parent variant to correctly get it and its children to scale when we re-scale the parent prefab (Tile), Is it because the Transform is all or nothing? Change one thing (Rotation) automatically overrides the Position and Scale parts of the component?

It is just Gary never says why we have to do that revert and it wasn’t and isnt clear to me :slight_smile:

Thanks very much

Paul

Hi,

The Transform sometimes changes its values when we drag and drop game objects or parent them. To be on the safe side, Gary sets the scale manually. This way, we will not get any confusing side-effects. Also, a tidy project and consistency are preferrable. If all tiles have the same scale values, debugging will be easier if we have to debug something.

Of course, this is not the only way to create our game world. We could achieve the same with different scale values but, as aforementioned, this could make debugging difficult.

Did this clear it up for you?


See also:

1 Like

Hi Nina,
Thanks for getting back to me.
I am afraid it doesnt. at 06:00 in the video Gary shows the issue and then goes on to say at 06:30 we have to be wary about the Prefab Variant workflow. And shows that the Scale of the Straight road prefab Variant has gone bold. And then does the revert. I thought initially that the process of creating a prefab variant by design shows Position, rotation and scale as bold as a visual indicator that those component values are overridden from the Tile prefab. But when Gary goes on to create the Corner prefab variants we do not need to revert the scale?

And these are seperate prefabs to the road straight . So by rights in my mind we should of reverted the scale on the first prefab variant corner… as we did when we created the road prefabs…

So I do not understand why it goes bold, and why we did not do the same process for the corners…

Thanks
Paul

EDIT: I tried looking in the documentation for an explanation but could not find one. If you can point me to any helpful documents that would be awesome too :smiley:

Prefabs do not have a position or a rotation. Or rather: Those values are irrelevant because they get set when we instantiate the prefab. Nevertheless, many game developers prefer rounded values which are easy to interpret. If a prefab has got unexpected values, one might think that they were set on purpose, and that could be confusing.

Unfortunately, the Unity manual is often limited. I cannot find any information on this subject either. At the moment, I’m afraid we’ll have to test the behaviour to figure Unity’s rules out. However, that does not necessarily explain the reasoning behind the concepts. Sometimes, there are visual bugs in Unity. Which version of Unity do you use?


For the child of a prefab, the Transform values are relevant because they are relative to the parent. A prefab does not have a parent. In the Unity scene, the “parent” of a game object without a parent in the Hierarchy is the origin.

I think I am just going to have to accept you have to revert the scale when you create a variant of a variant Nina :slight_smile:

Thank you for trying to assist :slight_smile:
It just niggles me that I am doing something without understanding why :slight_smile:

Thanks again for your patience.

Paul

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms