Forum rules - please read before posting.

Adding 2DXFX to UI element

Hi
Is it possible to add 2DXFX to an individual UI element i.e. a button. I am hoping to be able to use the Vetasoft sprite 2DXFX which do work with the Unity UI canvas, as a component to an AC menu element. The idea is after a timer goes off it hides one element and shows another with the second element having a 2DXFX effect on it.

Not quite certain how to do this - I did try something on the lines of 
myButtonElement = KickStarter.player.AddComponent(_2dxFX_Shiny_Reflect); with _2dxFX_Shiny_Reflect being 
the name of the script.
Does this require vetasoft 2Dxfx to be integrated with AC really to work.

Pity buttons do not have an add component section in the editor but as I guess to add any components such as 
2Dxfx would require a lot of additional work.

Any pointers you can give would be much appreciated.

Comments

  • That line of code references the player, and the AddComponent method will not return a menu element.

    Your AC Menu will have to be drawn with Unity UI, as the default "Adventure Creator" drawing method is not component-based and so components cannot be added to it.  A tutorial on converting Menus to rely on Unity UI can be found here.  See also the "Unity UI menus" chapter of the Manual.

    Once your AC Menu is linked to a Unity UI canvas, you can just add the required component onto the UI prefab itself.
  • Thanks, Chris. I'll do that.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.