Unity&dragonbones use of Dragonbones functions cannot be placed on the update function __unity

Source: Internet
Author: User

During debugging, you also encounter the following issues


The processor architecture "MSIL" of the generated project does not match the processor architecture "x86" that references "Amplifymotioneditor".


The above problem, restart unity on the line.



Unity5.5.0p4
1. Normally when I use Person_armature.animation.Play ("standing") in Unity's start function; Can be animated, and it is possible to change the state of the animation through the Insperctor view
2. Wrong situation however, once a new function TestKey () is customized, the animation cannot be used properly when the TestKey () function is put into the update function. I can't lift my feet.
void Update () {TestKey ();}
private void TestKey () {if Input.getkey (mkeyright) | | Input.getkey (mkeyleft) | | Input.getkey (Mkeybackward) | | Input.getkey (Mkeyforward) | | Input.getkeydown (mkeyright) | | Input.getkeydown (mkeyleft) | | Input.getkeydown (Mkeybackward) | |         Input.getkeydown (Mkeyforward)) {Person_armature.animation.Play ("walking");         }//else {person_armature.animation.Play ("standing"); }//     }//

Please look, why not. Thank you


---------------------------------------------------------------------------- Official reply

This is a relatively low-level error, with DB does not have much relationship, can refer to this problem HTTPS://GITHUB.COM/DRAGONBONES/DRAGONBONESCSHARP/ISSUES/17

Armature.animation.play ("Go"); The idea is to play a walking animation from the first frame.

Think about what will happen in the following situation.
Execute per frame ()
{
Armature.animation.play ("Go");
}


Use Player.animation.GetState ("Walk"). IsPlaying to determine if an animation is playing

If not, use Player.animation.play ("Walk");


--------------------------------------------------------------------------------------------------------------- The-----------------------------------------workaround is as follows:

 private void TestKey () {if Input.getkey (mkeyright) | |
            Input.getkey (mkeyleft) | |
            Input.getkey (Mkeybackward) | |
            Input.getkey (Mkeyforward) | |
            Input.getkeydown (mkeyright) | |
            Input.getkeydown (mkeyleft) | |
            Input.getkeydown (Mkeybackward) | | Input.getkeydown (Mkeyforward))//When the button is pressed {if (Person_armature.animation.lastAnimationName = = "Running")//when the previous animation state of the skeleton animation is "running"             {                 if (person_ Armature.animation.GetState ("Running"). isplaying)//When the last animated state of the skeletal animation is "running" is playing                  {         
           Debug.Log (":::::::: = =" + Status_person);                }                  else//when the last animated state of skeletal animation is "run" is not playing                  {                     Person_armature.animation.Play ("
Running ");                }             }              else//when the last animated state of skeletal animation is not "running"             {                 Person_
Armature.animation.Play ("Running");            }  }//The If judgment key presses the statement      else      {if (person_armature.animation). Lastanimationname = = "Walking")             {                 if (person_ Armature.animation.GetState ("Walking"). IsPlaying)                  {             
       Debug.Log (":::::::: = =" + Status_person);                }                  Else                  {                     Person_armature.animation.Play ("Walking");                }             }              Else             {     
           Person_armature.animation.Play ("Walking");            }     }//else statement end}//
 TestKey function End
Why should I add
When the last animated state of skeletal animation is "running"
The judge, because now the state of play is "walking", animation for "Running" animation, no instantiation

The rest of the states are not instantiated, and they are assigned an error and cannot be compiled


The code looks like this: (the draft part of the code is not deleted)





End of Code section

--------------------------------------------------------------------------------------------------------------- -----------------------------------------
Summary Failure Time:

Think that if the state of the animation changes, it is necessary to get the current animation state and change the state of play animation


Find Data Http://developer.egret.com/cn/apidoc/index/name/dragonBones.Animation#play

Find the relevant information, find player.animation.isPlaying;

Not thinking, judging whether the different animation states are playing

Player.animation.GetState ("Walk"). isplaying;


The reason: Do not think about summing up the problem, why there is such a problem, what caused the current problem, how to solve the corresponding problem


Run successfully:

(Big picture)

It is best to precede the if (Person_armature.animation.lastAnimationName = = "Walking") statement

Add an If to judge if (Person_armature)

--------------------------------------------------------------------------------------------------------------- -----------------------------------------

References: (This article does not use the following articles)

1. "Unity 3D" Learning notes 46: Input and control?? Keyboard Events

2.

3.

4.

5.

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.