Unity3D -- add a sword mark effect (PocketRPG Trail plug-in)

Source: Internet
Author: User

First of all, I would like to thank you for your support. Due to the tight schedule of recent projects, the update speed may be slow! I hope you will understand that, of course, your support is my greatest motivation, and I will do my best to write better articles. Of course, because I am a newbie and I am not working in unity3D, however, I am very fond of this, so I am studying these things in my spare time. There is no practical practice and I cannot further interpret and analyze these things. Of course, I have read all my articles because I should know that the content I have written is far from basic. At the same time, many people have already written it in my blog! What should I do? Because I did not do this, I have nothing to share with you. At the same time, I am also thinking that the knowledge people write on their own blogs is their own, it is not mine, so it is necessary to write your own blog to deepen your influence! More practical practices can lead to more insights.

It seems that I have talked a lot today! Okay! Not much nonsense! Let's get started with today's content!

I believe you will know what this chapter introduces! Haha .... Yes, this is the sword mark! It looks gorgeous! This effect is what we are pursuing!

OK, let's try it now!

First, we need to download this plug-in PocketRPG and then import it to the plug-in

What we need to do is to increase this effect! The procedure is as follows:

Step 1: Create an empty object:

Ctrl + shift + n, then drag the empty object into the object we need to add the special effect

Here we name this empty object right_trail

Step 2: add a special effect script


Then configure


Step 3: Add a Mesh Renderer


Then select the appropriate material.


OK, so that we can complete what we need! The next step is to control the role!

Step 1: Add Animaltional Contronal components to the role

Press ctrl + shift + a. The component selection dialog box is displayed.


Search in the red box! Relatively easy

Step 2: complete the role script

Below is the code we provide;

Using UnityEngine; using System. collections; public class events: Events {public WeaponTrail events; private AnimationController events; private AnimationState state_idle; private AnimationState events; // Use this for initializationvoid Start () {mAnimalCtl = gameObject. getComponent <AnimationController> (); state_Attack1 = animation ["Attack1"]; state_Attack2 = animation ["Attack2"]; state_idle = animation ["Idle"]; mAnimalCtl. addTrail (left_train); mAnimalCtl. addTrail (right_train);} void OnGUI () {if (GUILayout. button ("trick 1", GUILayout. width (80), GUILayout. height (50) {mAnimalCtl. playAnimation (state_Attack1); StartCoroutine ("ResettoWait"); // start coroutine} if (GUILayout. button ("trick 2", GUILayout. width (80), GUILayout. height (50) {mAnimalCtl. playAnimation (state_Attack2); StartCoroutine ("ResettoWait");} if (GUILayout. button ("trick 3", GUILayout. width (80), GUILayout. height (50) {mAnimalCtl. playAnimation (state_idle) ;}} IEnumerator ResettoWait () {yield return new WaitForSeconds (0.5F); mAnimalCtl. playAnimation (state_idle );}}

Haha .... Look at this. It is suspected that this is an imitation! It can only be said that imitation is also a way of learning! At least for me now!

OK. I believe you will succeed step by step! Come on!



The following is a summary of my learning experience!

I personally think that this plug-in is actually divided into two parts: the first is the construction of this plug-in, that is, the text and text Commentary Section, and the code control section, of course, this code is mainly used to control the main character, not to control this plug-in! Don't confuse the order! There is a public variable WeaponTrail in the code controlled by the main character. This is the object controlled by our plug-in! Drag this to use it!



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.