Inspector
初步测试Inspector
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIInputField : DynamicUIElement
|
||||
{
|
||||
public string parameterName;
|
||||
public TMP_InputField inputField;
|
||||
|
||||
public override void Initialize(string parameterName)
|
||||
{
|
||||
this.parameterName = parameterName;
|
||||
inputField.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString();
|
||||
inputField.onEndEdit.AddListener(ApplyParameters);
|
||||
}
|
||||
|
||||
private void ApplyParameters(string text)
|
||||
{
|
||||
connectedGameElement.GetType().GetField(parameterName).SetValue(connectedGameElement, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user