Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
2
Question by Metastable · Sep 09, 2015 at 06:46 PM · uicanvasinputfield

How to get a multi-line Input Field text box to expand and become scroll able?

As the title mentions, I'm attempting to get a multi-line Input Field to become scroll able but the Text element refuses to expand even with a Content Size Fitter. Here is what I am currently working with.

The hierarchy: http://i.imgur.com/Rn3iVcC.png

The ScrollArea: http://i.imgur.com/6gPReIT.png

The Text: http://i.imgur.com/0rhoW13.png

When ever I enter enough text the text will simply disappear from the top rather than expand the Text element. Has anyone managed to get this to work?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by illa3d · Feb 09, 2017 at 11:10 AM

I've had a simmilar issue and compiled a workaround until Unity fixes the InputField functionality. All the combinations of layous/content fitters didn't yield proper display of the last line. The only downside is that you can't fix the height of the input field without a ScrollRect component, also in the example.

HACKY SOLUTION:

InputFieldMod.cs - http://pastebin.com/AHggHUMX

Example - http://illa3d.com/unity/inputfield_mod_v1.0.unitypackage

Comment
Add comment · Show 1 · Share
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
avatar image Sergiyha · Jan 15, 2019 at 03:51 PM 0
Share

Awesome !!!

avatar image
0

Answer by FStar · Sep 23, 2015 at 05:23 PM

You can set Text field to vertical overflow. Then put the ContentSizeFitter on the InputField, that you put below your scroll area in the hierarchy, not on it. It makes scrolling work but you'll get into other problems. Like selection of text not working properly and the InputFiled is pretty limited in the amount of text it can handle, it runs into problems with the rendering after some thousands of characters and starts throwing exceptions...

Comment
Add comment · Share
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
avatar image
0

Answer by bkachmar · Aug 01, 2017 at 10:51 AM

This is my setup to make a scalable input field:

Regular UI Text field with ContentSizeFitter vertical set to Preferred size and unchecked Raycast target.

As a child I add Input Field as Multi Line with with RectTransform "stretch" alignment, so that it takes the full size of it's parent.

The Text child of Input Field has the color set to invisible, so that it is not displayed at all.

And on Input Field Value Changed I set it's value to my parent Text.

With this setup when I type something inside the input field it is copied to it's parent "visible" text that is scalable.

The same way you can have a scroll view with a scroll bar and an Input Field taking up all the space (except of a few pixels on the right where the scroll bar is). And the text from InputField will be assigned to Scroll view.

Comment
Add comment · Share
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

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

6 People are following this question.

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

Related Questions

Control UI Input Field entirely with code? 1 Answer

Can't Click on Input Field (Canvas world Space) 1 Answer

GridLayoutGroup doesn't fit Canvas. 0 Answers

How to tell if a RectTransform is within the visible area of a ScrollRect 1 Answer

Canvas Structure for Different UI Panels 0 Answers


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