How to using dynamic dropdowns and inputs in text

In Unity, I’ll retrieve the value from the database (written in PHP, data coming from the service), and there’s no problem.

My problem is that my text data contains the [DropDown] or [DragDrop] tag, for example:

  1. At Brighton University, you can study [DragDrop] like science, history, literature, and business.
  2. The [DragDrop] tags are ready to answer your questions.
  3. You can join [DragDrop] groups with other students.
  4. The [DragDrop] is beautiful and safe.
  5. There are many [DragDrop] tags you can use in the library.

I want to change the fields containing the tag here.

If [DragDrop] is used, I should make it an input, and this input should be a fill-in-the-blank type where the user will click on answers in another list and then click on the input.

If [DropDown] is used, it should be a dropdown, and the option fields within it will be dynamically generated and user-selectable.

In the web environment, the text value is added to the database using the ckeditor, meaning it also contains HTML code. I parse/replace the [DropDown] or [DragDrop] fields with PHP, and the results are as shown in the images.

Is this possible with Unity?

Until performance becomes a blocker, everything is possible :wink:

This will be way more “manual” though than in web development because while Unity has some “rich text” support, it’s not as advanced as in Html.
I’d suggest to process the text into a list of objects from prefabs. Have a prefab for text, one for a dropdown and everything else you wanna display.
Then go through the text and instantiate the prefabs appropriately. Make sure to have them adapt their size approrpriately.
Next step will be to automatically arrange them. Horizontal and vertical layout groups will help though you might wanna search on Github or the asset store for some universal layout groups that essentially does the line breaks for you.

EDIT: Perhaps Unity - Manual: UI Toolkit can do this easier since it is webdesign-inspired but its normal usecase is to design the UI by hand in the provided editor.
I have little experience with it; maybe someone else can respond.

EDIT2:
Less flexible but possibly quicker because you wouldn’t need to code the placement of content yourself:
Use just TextMeshPro text elements and use either custom symbols for the gray boxes like here: https://www.youtube.com/watch?v=071Rzqz5ByM or the “mark” tag.
Then make them clickable this way (never tried whether icons can be clickable but I’d hope so):
Clickable link within a text