简体   繁体   中英

Unity 5 Trail Renderer on UI button

I'm having really hard time with new Unity 5 UI system and Trail Renderer. I'd like to attach trail renderer to UI Button. I need it to draw trail of user drag&drop action on button. Unfortunately, I can't see trail in game, it only appears in editor. I've tried many tricks with ordering, camera attachment etc. but nothing helped. Have somebody resolved this issue and can guide how to do this? Thanks!

You can create an empty gameobject with a trail renderer in the scene and on the update function use:

thisGameobjecct.transform.position = myButton.transform.position;

you are not using the trail on the button but it's the same results

Because if the camera's z value is the same with the trail renderer gameobject's z value ,the trail renderer gameobject will no to be seen in the game ,but you can see it in the scene inspector. So try to see it ,you will never set the camera's z value equals with trail renderer gameobject value. such as : no same with 0 .... I use this way to solve this problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM