Wondering about prefabs and anchoring/scaling problem?

So after posting a team building thing and thinking it was in incorrect area(No permission to delete post?). I am editing my post. changing it to the other course area of this site and posting a question I do have about prefabs. So I feel like I must be missing some anchoring that happened while doing the block breaker tutorial. I had combined it with the number UI. and after I made the background apart of a prefab call on my game status, it has suddenly done some weirdness with all my other backgrounds and buttons. It looks like it changed the scale of my GUI buttons that I had. Is this prevented by using anchors… I am a little lost as to exactly what happened.


that was it to begin… now is


My overall guess is that I need to go through and make everything a prefab now. then get back to addressing the fact my block isn’t wanting to break on the second go around and I am getting errors due to things not being assigned… I am going back to the tutorial and will hash this out… just any comments… Would love to hear suggestions. Thanks for your time.

Hi Ian,

Prefabs don’t have anything to do with what you see inside your scene while running your game. Only the elements in your Hierarchy matter.

https://docs.unity3d.com/Manual/UIBasicLayout.html

hm… Alright… Thank you for that. I may have missed something essential with a rect transform… I believe it happened when I deleted my original after making the prefab cause the script of GameStatus which is now GameSession was to call the score. I probably misunderstood something Rick said. Thinking he meant that it would call the parent prefab of the nested one and seems to have thrown off a bit of scaling. I will rewatch the part about… Thanks for your time.

I realized that my games aspect got changed. To free aspect and this is what shifted things around. I am unsure why or how. I guess I would have had to or is there a setting that changed this aspect indirectly now is a question I have. Good practice for me though on getting familiar and comfortable with all this on small scale. As well as the understanding that it looks like prefabs don’t have rect transforms just transforms(?).

What components do your prefabs have attached?

Depends on the prefab. I was just in the Gamestatus Prefab which (I hadn’t realized Rick had put the canvas under*) I was dealing with the singleton and the carry over of the score. I had to just fix the placement of my backgrounds. Now that I did this, it has a few other effects of carry over from my other scenes. I have to deal with making the score not visible and to reset upon losing.

It’s important to distinguish between non-UI and UI components. For example:

Non-UI component:
SpriteRenderer

UI component:
Image
Text
TextMeshProUGUI

UI components must be parented to a Canvas. They have a RectTransform component instead of a Transform which works with pixels.

Non-UI components have a Transform component. The position values are in World Units, not pixels. Non-UI elements should not be parented to a Canvas.

If you mix them, strange things might happen. So be careful! :slight_smile:

Hi Ian,

Do you still need help with this or did you manage to fix the issue?


See also:

Yes I believe so. Thank you for you time.

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

Privacy & Terms