
Ecran de sélection ok. Bug de latence trop peu importante sur la capture des entrées Reste surement deux trois bugs
25 lines
697 B
C#
25 lines
697 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class FitContentScript : MonoBehaviour
|
|
{
|
|
public int Padding;
|
|
private bool workDone;
|
|
public void OnRenderObject()
|
|
{
|
|
if (workDone) return;
|
|
var child = transform.GetChild(0);
|
|
if (child != null)
|
|
{
|
|
var childRect = child.GetComponent<RectTransform>();
|
|
if (childRect != null)
|
|
{
|
|
transform.gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(
|
|
childRect.sizeDelta.x + 2 * Padding, childRect.sizeDelta.y + 2 * Padding);
|
|
workDone = true;
|
|
}
|
|
}
|
|
}
|
|
}
|