private Image NewImage()
{
var resources = new DefaultControls.Resources();
var go = DefaultControls.CreateImage(resources);
if (Application.isPlaying)
{
GameObject.DontDestroyOnLoad(go);
}
go.layer = gameObject.layer;
var rt = go.transform as RectTransform;
if (rt)
{
rt.SetParent(rectTransform);
rt.localPosition = Vector3.zero;
rt.localRotation = Quaternion.identity;
rt.localScale = Vector3.one;
}
Image img = go.GetComponent <Image>();
img.raycastTarget = false;
return(img);
}