Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: appminis-mike on May 19, 2014, 10:21:28 PM

Title: Dynamically creating a UIButton throws an exception
Post by: appminis-mike on May 19, 2014, 10:21:28 PM
I'm trying to create a UIButton at runtime:

  1. NGUITools.AddChild<UIButton>(parentObject);
  2.  

This throws an exception, as the TweenTarget is not set. I don't see a way to set it, though, as the AddChild call itself throws the exception.

Is there a way to create a new UIButton in a script without causing an exception?

Thank you.
Title: Re: Dynamically creating a UIButton throws an exception
Post by: ArenMook on May 20, 2014, 01:00:02 PM
parentObject.AddComponent<UIButton>();