Inspector-2
加入Text,以及一些必要注释
This commit is contained in:
27
Assets/Scripts/DynamicUI/DynamicUIElements/DynamicUIText.cs
Normal file
27
Assets/Scripts/DynamicUI/DynamicUIElements/DynamicUIText.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIText : DynamicUIElement
|
||||
{
|
||||
public TMP_Text text;
|
||||
|
||||
public override void Initialize(string title, string parameterName)
|
||||
{
|
||||
base.Initialize(title, parameterName);
|
||||
text.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isAlwaysUpdated)
|
||||
{
|
||||
text.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user