// --------------------------------------------------------------------------------------------------------------------
//
// Part of: Pun Cockpit Demo
//
// developer@exitgames.com
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEngine.UI;
namespace Photon.Pun.Demo.Cockpit
{
///
/// Force a LayoutElement to march a RectTransform sizeDelta. Useful for complex child content
///
public class LayoutElementMatchSize : MonoBehaviour
{
public LayoutElement layoutElement;
public RectTransform Target;
public bool MatchHeight = true;
public bool MatchWidth;
void Update()
{
if (MatchHeight)
{
if (layoutElement.minHeight != Target.sizeDelta.y)
{
layoutElement.minHeight = Target.sizeDelta.y;
}
}
}
}
}