Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Zerith · Dec 23, 2020 at 08:35 PM · scrollingscrollbar

Scrollbar Automatically Resizing on Play, Stays Resized in Editor

Hello! I am using Unity 2020.1 to create a text-based adventure, but my scrollbar component’s size keeps changing to 1 when I click play. I want to set the scrollbar size to be 0.2. When I end play the scrollbar remains resized to 1 even though changes made while in playmode shouldn’t affect editing mode.

This resizing issue only happens when I assign the scrollbar to a scroll rect. I have tried deleting and recreating the scroll rect. I have also tried taking the scroll rect and scrollbar outside of the canvas to see if it was an issue with the canvas. The scrollbar still resizes itself.

I have tried setting the value of the scrollbar to many different numbers but no matter what number I put it is resized to 1.

I have tried using this script to resize the scrollbar on awake and then I assign ChangeScrollPs() to the scrollbar to be cused OnValueChanged() for the scrollbar. This changes the size of the scrollbar but when I move the handle the text does not change position. It is also worth noting that this script does not change the size of the scrollbar if I put “scollbar.size = 0.2f” in Awake() instead of Update().

 using UnityEngine;
 using UnityEngine.UI;
 
 public class ScrollbarFix : MonoBehaviour
 {
 
     public Scrollbar scrollbar;
     public ScrollRect scrollRect;
     // Use this for initialization
     private void Update()
     {
         scrollbar.size = 0.2f;
         scrollRect.horizontalNormalizedPosition = 0.4f;
 
     }
 
     public void ChangeScrollPos()
     {
         scrollRect.horizontalNormalizedPosition = scrollbar.value;
     }
 }

How can I make my scroll bar stay the size I set it to?

Here is a picture of the scrollbar component:

alt text Here is a picture of the scroll rect component: alt text

Here is a link to download the project to play with: https://github.com/Daniel-Nimitz/Text-Based-Adventure/tree/Scrollbar-resizing-issue

scollbar-componant.png (210.2 kB)
rect-component.png (197.3 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

110 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do i move the vertical scrollbar thumb using left-mouse click and dragging it ? 2 Answers

Smooth scrollbar movement on display release 0 Answers

How can I create a Multi line Input Field with Scrollbar? 0 Answers

Move Dropdown using arrow buttons 0 Answers

Changing the scale of the scroll view 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges