本文整理汇总了C#中SceneObject.GetChild方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObject.GetChild方法的具体用法?C# SceneObject.GetChild怎么用?C# SceneObject.GetChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SceneObject
的用法示例。
在下文中一共展示了SceneObject.GetChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnitTest1_ManagedSerialization
/// <summary>
/// Tests managed object serialization and deserialization.
/// </summary>
static void UnitTest1_ManagedSerialization()
{
SceneObject otherSO = new SceneObject("OtherSO");
UT1_Component2 dbgComponent2 = otherSO.AddComponent<UT1_Component2>();
dbgComponent2.a2 = 33;
SceneObject so = new SceneObject("TestSO");
UT1_Component1 dbgComponent = so.AddComponent<UT1_Component1>();
dbgComponent.a = 5;
dbgComponent.b = "SomeTestVal";
dbgComponent.complex.someValue = 19;
dbgComponent.complex.anotherValue = "AnotherValue";
dbgComponent.complex2.someValue2 = 21;
dbgComponent.complex2.anotherValue2 = "AnotherValue2";
dbgComponent.arrA = new int[5];
dbgComponent.arrA[4] = 5;
dbgComponent.arrB = new string[5];
dbgComponent.arrB[4] = "ArrAnotherValue";
dbgComponent.arrComplex = new UT1_SerzObj[5];
dbgComponent.arrComplex[4].someValue = 99;
dbgComponent.arrComplex[4].anotherValue = "ArrComplexAnotherValue";
dbgComponent.arrComplex2 = new UT1_SerzCls[5];
dbgComponent.arrComplex2[4] = new UT1_SerzCls();
dbgComponent.arrComplex2[4].someValue2 = 101;
dbgComponent.arrComplex2[4].anotherValue2 = "ArrComplex2AnotherValue";
dbgComponent.listA = new List<int>();
dbgComponent.listA.Add(5);
dbgComponent.listB = new List<string>();
dbgComponent.listB.Add("ListAnotherValue");
dbgComponent.listB.Add(null);
dbgComponent.listComplex = new List<UT1_SerzObj>();
dbgComponent.listComplex.Add(new UT1_SerzObj());
dbgComponent.listComplex.Add(new UT1_SerzObj(99, "ListComplexAnotherValue"));
dbgComponent.listComplex2 = new List<UT1_SerzCls>();
dbgComponent.listComplex2.Add(new UT1_SerzCls());
dbgComponent.listComplex2[0].someValue2 = 101;
dbgComponent.listComplex2[0].anotherValue2 = "ListComplexAnotherValue";
dbgComponent.listComplex2.Add(null);
dbgComponent.dictA = new Dictionary<int, string>();
dbgComponent.dictA[5] = "value";
dbgComponent.dictA[10] = "anotherValue";
dbgComponent.dictB = new Dictionary<string, UT1_SerzObj>();
dbgComponent.dictB["key1"] = new UT1_SerzObj(99, "DictComplexValue");
dbgComponent.otherComponent = dbgComponent2;
dbgComponent.otherSO = otherSO;
Internal_UT1_GameObjectClone(so);
System.Diagnostics.Debug.Assert(so.GetNumChildren() == 1);
for (int i = 0; i < so.GetNumChildren(); i++)
{
SceneObject childSO = so.GetChild(i);
UT1_Component1 otherComponent = childSO.GetComponent<UT1_Component1>();
DebugUnit.Assert(otherComponent.a == 5);
DebugUnit.Assert(otherComponent.b == "SomeTestVal");
DebugUnit.Assert(otherComponent.complex.someValue == 19);
DebugUnit.Assert(otherComponent.complex2.anotherValue2 == "AnotherValue2");
DebugUnit.Assert(otherComponent.arrA[4] == 5);
DebugUnit.Assert(otherComponent.arrB[4] == "ArrAnotherValue");
DebugUnit.Assert(otherComponent.arrComplex[4].someValue == 99);
DebugUnit.Assert(otherComponent.arrComplex2[4].anotherValue2 == "ArrComplex2AnotherValue");
DebugUnit.Assert(otherComponent.listA[0] == 5);
DebugUnit.Assert(otherComponent.listB[0] == "ListAnotherValue");
DebugUnit.Assert(otherComponent.listComplex[1].someValue == 99);
DebugUnit.Assert(otherComponent.listComplex2[0].anotherValue2 == "ListComplexAnotherValue");
}
so.Destroy();
otherSO.Destroy();
}