RequirePlatformSupportAttribute

class in UnityEditor.TestTools

매뉴얼로 전환

설명

Mark a test or test fixture as requiring that particular platform support has been installed into Unity.

This attribute can be used in Editor tests to indicate that the test requires support for particular platforms to have been installed. If the required support is not available, the test will be skipped.

For example, tests that use the BuildPipeline API to build a player for iOS may wish to use this attribute to indicate that they require iOS support to be installed, avoiding test failures when the tests are run on a machine without iOS support installed.

using UnityEditor;
using UnityEditor.TestTools;
using NUnit.Framework;

public class MyBuildTests { [Test] [RequirePlatformSupport(BuildTarget.StandaloneWindows64)] public void CanBuildForWin64Bit() { var result = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, System.IO.Path.GetTempFileName(), BuildTarget.StandaloneWindows64, BuildOptions.None); Assert.Equals("", result); } }

변수

platformsThe list of platforms required by the test or test fixture marked with this attribute.

생성자

RequirePlatformSupportAttributeSpecifies that the test or test fixture requires particular platform support to be installed. See RequirePlatformSupportAttribute.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961