Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Bug Is it possible to create a UI button prefab?

Discussion in 'UGUI & TextMesh Pro' started by AlanMattano, Oct 5, 2020.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,478
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @AlanMattano

    "When I enter in prefab mode I'm not able to drag and drop a game object from the inspector to assign it to the event OnClick of the button."


    Do you mean you can't drag some object from scene or from prefab itself to some field in prefab?

    You can drag any of prefab's component just fine to button component's onClick...?

    But you can not link scene content to prefabs. This works the same way for all the assets...
     
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,478
    Yes
    Yes
    Yes
    Bug by design. Using U2018, 2017, Unity5 4 Prefab system was fine.
    Is more noticeable in a UI button. how do you connect it?
    Is it possible to make a UI button Prefab?

    If so is a major bug by design.
     
    Last edited: Oct 6, 2020
  4. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @AlanMattano

    I use UI prefabs all the time. You simply can't refer to scene objects.
     
  5. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,478
    So the new Prefab system became now so complex that I can't make a button?
    To make my Ui button work, I end up unpacking the prefab completely and not using a prefab.

    How do you link to the prefab UI button event a script if you can't drag and drop it?
    upload_2020-10-6_14-23-54.png
     
    Last edited: Oct 6, 2020
  6. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,478