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
0
Question by zKici · May 17, 2017 at 05:34 PM · multiplevaluescopyexcelpaste

Copy Paste Row Column from Excel into Unity Input Fields all at once

Hello,

I have about 14 cells in a row in Excel, would like to copy that into 14 Unity input boxes all at once.

  1. I copy the 14 cells as per usual workflow in Excel,

  2. Paste starting the "1st" input box in Unity,

  3. all of the "14 cells" data is pasted into the 1st input box....

Work around please?

  1. I would like to achieve this with multiple rows and columns as well...

Thank you!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by toddisarockstar · May 19, 2017 at 11:58 PM

Unity has absolutely nothing to do with excel! unity is not intended as a word processor so it sopports basic reading of text in ascii or UTF8 format....it's going to read text just like basic windows notepad.

so Your best approach would be exporting your text from excel into a basic txt format. then put that into your unity asset folder as a text asset

https://docs.unity3d.com/Manual/class-TextAsset.html

once the text asset is in your game assets. It could be dragged an dropped into an empty text asset variable declaired in one of your scripts.

alternativly unity has the ability to read text directly from a hard drive if you are making a project for PC.

  // need this at top of script
  using System; 
  using System.IO; 
  using System.Diagnostics;
  
       //write a file to a hard drive like this:
       File.WriteAllText("C:/somefolder/somefile.txt","blah blah blah");
       
       //read a file on a hard drive like this:
       String txt;
       if(File.Exists("C:/somefolder/somefile.txt")){
          txt=File.ReadAllText("C:/somefolder/somefile.txt");
          print("got this: "+txt);}

from there you would need to manualy program into your unity code what to do with it. or how to display it. unity is not going to understand row or colum information from exell. You would have to manually program code yourself for that sort of thing.

Comment
Add comment · Show 5 · 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 zKici · May 20, 2017 at 01:58 AM 0
Share

Thank you for the response/answer,

Any pointers on how to designate that "blah blah blah" is for example A1 = (1st) blah, A2 = (2nd) blah and so forth?

perhaps the blahs should be divided somehow, example blah|blah|blah, meaning each "|" is referring to another cell for excel, for input box, word etc?

Thanks again

avatar image toddisarockstar zKici · May 20, 2017 at 06:55 AM 0
Share

yes...you can split a string into an array of strings at a seporator charactor or string like this:

     public String[] txts;
     int i;
     int i2;
     int i3;
 
     void Start(){
 string original = "bubbles|turtle|blah|chickens|green|wonkabar|batman|hippie";
         txts = original.Split ("|" [0]);
     }
 
     void OnGUI (){
                 i = 0;
                  i2 = 0;
                  i3 = 0;
                 while (i<txts.Length) {
                 // display what we read
                 GUI.Label(new Rect(200*i2,80*i3,300,40),txts[i]);
                  i2++; if(i2>2){i2=0;i3++;}
                 i++;
                 }
 
         }
avatar image toddisarockstar zKici · May 20, 2017 at 07:12 AM 0
Share

i am not fimiliar with excell or its output. but if you would like to post an example of what you are trying to load i can show you how to manually split it up.

avatar image zKici toddisarockstar · May 21, 2017 at 02:47 PM 0
Share

Alright,

Thanks for all the help you have been providing,

Example:

  1. Excel with 6 cells

alt text

  1. Copy paste,

  2. In notepad it appears it has a "tab" spacing between each value copied from cells (the script you write above is based on a blackslash, how to adjust it to be based on this spacing?)

alt text

  1. Pasting all these "6" values into 6 Unity UIs at the same time by Ctrl+V

Thank you again, very helpful.

ex1.jpg (14.5 kB)
ex2.jpg (14.8 kB)
Show more comments

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

105 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

Related Questions

Why can't I copy/paste code snippets into MonoDevelop? 9 Answers

Can you store multiple x or y coordinates from different gameobjects in one variable and then compare all the stored values in a function? 0 Answers

Compute Shader Pass RWStructuredBuffer by Reference 1 Answer

Is there a simply script edit to spawn more than one rigidbody at a time using the script below? 0 Answers

How can i tell which joystick input came from? 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