Пример #1
0
        void TestHeapVariableGet()
        {
            GameObject newObject = VRCInstantiate(referenceSpawnObject);

            // Have a separate case that will force find the script because of the above issue. We know in this specific test case that the only UdonBehaviour on the object will be of the type `InstantiatedObjectTesterScript`
            InstantiatedObjectTesterScript testScript = (InstantiatedObjectTesterScript)newObject.GetComponent(typeof(UdonBehaviour));

            tester.TestAssertion("Instantiated Object Get Field", testScript.testValueStr == "test");

            Destroy(newObject);
        }
Пример #2
0
        void TestHeapVariableGetComponent()
        {
            GameObject newObject = VRCInstantiate(referenceSpawnObject);

            InstantiatedObjectTesterScript testScript = newObject.GetComponent <InstantiatedObjectTesterScript>();

            // GetComponent<User T>() will fail immediately after instantiation because the script ID heap variable returns null, so U# has no way to determine the script type
            tester.TestAssertion("Instantiated Object GetComponent<T>()", testScript != null);

            Destroy(newObject);
        }
Пример #3
0
        void TestHeapVariableSet()
        {
            GameObject newObject = VRCInstantiate(referenceSpawnObject);

            InstantiatedObjectTesterScript testScript = (InstantiatedObjectTesterScript)newObject.GetComponent(typeof(UdonBehaviour));

            testScript.testValueStr = "test set";

            tester.TestAssertion("Instantiated Object Set Field", testScript.testValueStr == "test set");

            Destroy(newObject);
        }
Пример #4
0
        void TestCustomEvent()
        {
            spawnCounter = 0;

            GameObject newObject = VRCInstantiate(referenceSpawnObject);

            InstantiatedObjectTesterScript testScript = (InstantiatedObjectTesterScript)newObject.GetComponent(typeof(UdonBehaviour));

            testScript.spawnerBehaviour = this;
            testScript.CallEvent();

            tester.TestAssertion("Instantiated Object Send Event", spawnCounter == 1);

            Destroy(newObject);
        }