give me an example of how to get the currently selected tmpdropdown item text
- User
give me an example of how to get the currently selected tmpdropdown item text
- Assistant
To get the currently selected text from a dropdown list (often referred to as a
<select>element in HTML) using JavaScript, you can use the following example. This example assumes you have a dropdown element with an id, and it shows how to retrieve the selected item's text when a button is clicked.html - User
tmp dropdown is unity with textmeshpro
- Assistant
- User
fix this: public List MyLoras() = new List();
- Assistant
The code you've provided has a syntax error. The proper syntax to define a property or method that returns a list in C# is slightly different. If you want
MyLorasto be a property that returns a list of strings, it should look like this:As a Property:
csharppublic List<string> MyLoras { get; } = new List<string>();As a Method:
If you intend for
MyLoras()to be a method that returns a list of strings, then it should be defined as follows:csharppublic List<string> MyLoras() { return new List<string>(); }Example with Initialization:
If you want to initialize the list with some values right away, you can do the following for either option:
As a Property with Initialization:
- User
fix santax: unity: public List MyInputList = new list();
- Assistant
The syntax you’ve provided has a couple of minor issues to fix. Here’s the corrected version for declaring and initializing a
List<string>in Unity using C#:Correct Syntax
For declaring and initializing a
List<string>, you should useList<string>with a capital "L" in . Here's how you can do it: