Automatically created "Buttons" with reference to file.

Hello, I am currently working on some file reading app. I came across an issue. When the script finds file with .pdf …
ending, I want script to make a new “button” by a template( template includes some images, text elements and buttons). I cant figure out how to make this button so the sprite, text element, buttons are refering to this specific file.Thanks for any help, all love --Me

There are two parts to this so be sure you break apart and test things invididually:

  1. reading data from the PDF

  2. filling out the UI with the data

Part 1 is hard because PDF files are a total mess of a file format that has been horribly designed from the outset and then built upon haphazardly over nearly 30 years now. There are assets on the Unity asset store to help you, but I would never even consider trying to read a PDF in production code. I would always insist the user exports it to an open format such as a text file or CSV file.

Part 2 is trivial Unity UI stuff. Look up any of the thousands of Youtube tutorials on how to make a unity level selector or unity item selector or just work through any 2 or 3 basic UI tutorials because it’s going to be entirely dependent on the cohort of data that you are setting, eg images, text, etc.

Ironically, I have already 1st Part programmed. For 2nd part I’ll try my best, thanks for reply :slight_smile:

How are you loading the PDF please? a Webrequest? Custome reader code?