本文整理匯總了C#中UnityEditor.SerializedObject.NextVisible方法的典型用法代碼示例。如果您正苦於以下問題:C# SerializedObject.NextVisible方法的具體用法?C# SerializedObject.NextVisible怎麽用?C# SerializedObject.NextVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEditor.SerializedObject
的用法示例。
在下文中一共展示了SerializedObject.NextVisible方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddComponent
/// <summary>
/// Adds the copy of a Component to a GameObject.
/// </summary>
/// <param name="go">The GameObject that will get the new Component</param>
/// <param name="original">The original component to copy</param>
/// <returns>The reference to the newly added Component copy</returns>
public static Component AddComponent(this GameObject go, Component original)
{
var c = go.AddComponent(original.GetType());
var originalSerialized = new SerializedObject(original).GetIterator();
var nso = new SerializedObject(c);
var newSerialized = nso.GetIterator();
if(originalSerialized.Next(true))
{
newSerialized.Next(true);
while(originalSerialized.NextVisible(true))
{
newSerialized.NextVisible(true);
newSerialized.SetValue(originalSerialized.GetValue());
}
}
nso.ApplyModifiedProperties();
return c;
}