Unity3d C # Opens an external application and detects if the application closes the exit

Source: Internet
Author: User

Welcome to Unity Learning, unity training, Unity Enterprise training and education zone, there are many u3d resources, u3d training videos, u3d tutorials, U3d Frequently asked questions, U3d Project source code, we are committed to creating the industry Unity3d training, learning the first brand.

Unity3d C # Opens an external application and detects whether the application closes the exit implementation code.

Using Unityengine;

Using System.Collections;

Using System.Diagnostics;

Using System;

public class Startotherapp:monobehaviour {

Private Process pc;

void Start () {

Startcoroutine (STARTAPP ());

}

IEnumerator StartApp ()

{

Yield return new Waitforseconds (2);

PC = Process.Start ("C:/users/lee/desktop/flash videoplayer/vrplayer/vrplayer.app/vrplayer.exe");

Pc. EnableRaisingEvents = true;

Pc. Exited + = new EventHandler (myprocess_exited);

}

void Myprocess_exited (object sender, EventArgs e)

{

Application.Quit ();

}

}


Unity3d about the movement of the Code



Motion related is generally written in the update, the actual development, need to know what is required to detect each frame, which is triggered.

The classes below input are generally written in the update because each frame needs to be instrumented.

Ontriggerenter (); ontriggerstay;ontriggerexit; the corresponding is oncollisionenter .... If Istrigger is checked, the trigger class is required.

Functions that can be used for motion. We should choose the appropriate function in a more specific context.

Rigidbody (2D) Velocity,

To move in a certain direction

Velocity=transform. Transformdirection (vector3.forward*100);

Transform.translate,

To move in a certain direction

Playertransform.translate (vector3.right*time.deltatime* (-movespeed.x));

Vector3.movetowards,

Move to Target Point

Playertransform.position=vector3.movetowards (Playertransform.position,tagerpoint.position,200*time.deltatime);

Can also be operated directly transform.position






For more highlights, please click http://www.gopedu.com/


Unity3d C # Opens an external application and detects if the application closes the exit

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.