Please tell me, what am I doing wrong?
I need change text button into script. The text of the button on the scene changes, but there is no button in the settings.
I need change text button into script. The text of the button on the scene changes, but there is no button in the settings.
C#:
const string uiButtonName = "Pink";
Atom uiButtonAtom = SuperController.singleton.GetAtomByUid(uiButtonName);
if(uiButtonAtom == null || uiButtonAtom.type != "UIButton")
{
SuperController.LogError($"No UIButton atom found with name '{uiButtonName}'");
return;
}
// The transform which contains the clickable button component in the UIButton atom's gameobject hierarchy
Transform buttonTransform = uiButtonAtom.transform.Find("reParentObject/object/rescaleObject/Canvas/Button");
if(buttonTransform == null)
{
SuperController.LogError($"Could not find the button transform of UIButton '{uiButtonName}'");
return;
}
var txt = buttonTransform.GetComponentInChildren<Text>();
txt.text = "new name";
Last edited: