Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

RequirePlatformSupportAttribute

class in UnityEditor.TestTools

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

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.

#pragma strict
public class MyBuildTests {
	@Test
	@RequirePlatformSupport(BuildTarget.StandaloneWindows64)
	public function CanBuildForWin64Bit() {
		var result: var = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, System.IO.Path.GetTempFileName(), BuildTarget.StandaloneWindows64, BuildOptions.None);
		Assert.Equals("", result);
	}
}
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); } }

Properties

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

Constructors

RequirePlatformSupportAttributeSpecifies that the test or test fixture requires particular platform support to be installed. See RequirePlatformSupportAttribute.

Did you find this page useful? Please give it a rating: