using System;
using System.Collections.Generic;
using System.Text;
namespace UnityEngine
{
///
/// Transform的扩展
///
public static class TransformExtension
{
///
/// 获取组件的操作,如果有则直接获取,没有,则添加
///
///
///
///
public static T RequireComponent(this Transform trans) where T : Component
{
var cm = trans.GetComponent();
if (cm == null)
{
cm = trans.gameObject.AddComponent();
}
return cm;
}
///
/// 设置Parent,集成Cinematic Editor后,有用到tranform.SetParent这种写法
///
///
///
///
public static void SetParent(this Transform trans) where T : Component
{
}
}
}