Saltar al contenido principal

Check which programs your world build holds

A world build holds the program of a behaviour only when the scene has that behaviour. To check that a behaviour your world needs reaches the build, or that one meant only for the Editor stays out, build the scene in an Edit Mode test with BuiltWorld.

Steps​

  1. In your Tests/EditMode folder, create a test class that opens your world scene and builds it once for all its tests:

    using NUnit.Framework;
    using Tsvrc.UdonTestKit;
    using UnityEditor.SceneManagement;

    public class WorldBuildTests
    {
    private BuiltWorld _world;

    [OneTimeSetUp]
    public void BuildTheWorld()
    {
    EditorSceneManager.OpenScene("Assets/Scenes/MyWorld.unity");
    _world = BuiltWorld.FromWorldScene();
    }
    }
  2. Add a test for each behaviour to check:

    [Test]
    public void HoldsProgramOf_Scoreboard_IsTrue()
    {
    Assert.That(_world.HoldsProgramOf(typeof(Scoreboard)), Is.True);
    }

    [Test]
    public void HoldsProgramOf_DebugMenu_IsFalse()
    {
    Assert.That(_world.HoldsProgramOf(typeof(DebugMenu)), Is.False);
    }
  3. Run them from the EditMode tab of the Test Runner.

What to watch for​

The build holds each program as UdonSharp last compiled it for the Editor, because it skips the compile for upload. To check that compile too, see Check that your world compiles for upload.

The loaded scenes have to hold exactly one scene descriptor, and the world scene, the one that holds it, has to be saved, or the VRChat SDK builds nothing. FromWorldScene checks both first and throws an error that says which.