本文整理匯總了C#中UnityEngine.RectTransform.GetComponentInParent方法的典型用法代碼示例。如果您正苦於以下問題:C# RectTransform.GetComponentInParent方法的具體用法?C# RectTransform.GetComponentInParent怎麽用?C# RectTransform.GetComponentInParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEngine.RectTransform
的用法示例。
在下文中一共展示了RectTransform.GetComponentInParent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Open
/// <summary>
/// Open animation.
/// </summary>
/// <returns>Animation.</returns>
/// <param name="rect">Rect.</param>
/// <param name="time">Time.</param>
public static IEnumerator Open(RectTransform rect, float time=0.5f)
{
if (rect!=null)
{
var layout = rect.GetComponentInParent<EasyLayout.EasyLayout>();
var max_height = rect.rect.height;
var end_time = Time.time + time;
while (Time.time <= end_time)
{
var height = Mathf.Lerp(0, max_height, 1 - (end_time - Time.time) / time);
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
if (layout!=null)
{
layout.NeedUpdateLayout();
}
yield return null;
}
//return height back for future use
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, max_height);
}
}
示例2: EndRecord
void EndRecord(EMMotionProperties motion,RectTransform rect){
startRect.ApplyAllToRectTransform( rect, rect.GetComponentInParent<CanvasGroup>() );
}
示例3: Awake
void Awake()
{
rect = GetComponent<RectTransform>();
canvas = rect.GetComponentInParent<Canvas>();
}