C # Programmer's Consolidation of Unity 3D notes (ix): Analysis of Unity 3D test

Source: Internet
Author: User


  
A class on a component in unity cannot be new, it must be fetched through the component, and the new thing is null.
if (Amainfo.namehash = = Animator.stringtohash (Base layer.idle))
{
M_animator. Setbool (Run, true);
}
when the code cannot be executed, click Bake in the navigation panel, as
  

You must add a collision component for the collider, otherwise the Physics.raycast function cannot detect
Delete destory time, otherwise the resulting multithreading will result in inaccurate count!
Unity3d comes with a test tool that you only need to download in the asset store and then import, and when you're finished, the menu item will have unity test tools items (such as), and the plugin's import will be ready for unit testing.
  
  
Unity3d unit tests and VS2010 unit tests are pretty much the same, and unit tests using Unity3d are much simpler if you've been exposed to unit tests of vs.
1. Create a new ' Editor ' folder to build a unit-tested class in the folder, such as
  
2. Add the required test method to the test class file, as in the unit test in VS, as shown in:
  
3. To complete the new test class, click Unit Test Runner in the Unity Test Tools menu to perform the units tests, such as:
  
4. Click on the Unit Test menu, go to the test screen, click the Start Test button, you can see our new test class and the method containing the need to test, when the green check mark, indicating that the test passed, otherwise, the test failed, such as:
  
These are the basic steps of the Unity3d unit test run, and if you are familiar with the VS development platform, you will find that the unit tests with VS are almost identical.
Integration Test Integration
because unit tests can only test the logic of individual functions and cannot emulate a real game run scenario, the simulation of a general game scenario will still use integration testing. Unity3d's integration test invokes Unity's running functions, testing the use cases individually. Equivalent to the actual game running environment.
integration testing is divided into dynamic integration testing and general integration testing
1. General integration testing, if you want to test a gameobject, you need to add 2 of the script components,
  
menu, when you are finished, you can test the components, run
  
, you can see the results. such as:
  
Figure 1
  
Figure 2
Each integration test needs to be judged by the asserted component, which is used only for simple tests such as the range of coordinates moving, whether it needs to be visible, and so on.
Dynamic Integration Testing
Create a new test, under which a gameobject is created, and the Testscript script is created to bind to the gameobject.
if the scene is under the name, the dynamic test script is automatically mounted to the test panel. such as:
  
create a new. cs file, creating several test classes. Then for different modules, divided into different test scenarios, to test, you can. can also support Ngui and many other plugins. The button response event forces a call with reflection.

For more information, please visit the Dog Planing Learning Network Unity3d training expert: www.gopedu.com


Disclaimer: This document is from the "Dog Planing Learning Network" community, is the Netizen self-published Unity3d study articles, if there is any content violated your relevant interests, please communicate with the official, we will deal with the real-time.
For more information, please visit the Dog Planing Learning Network Unity3d training expert: www.gopedu.com

C # Programmer's Consolidation of Unity 3D notes (ix): Analysis of Unity 3D test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.