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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Addressable prefab with script attached

Discussion in 'Addressables' started by PopsawayGames, Jul 1, 2021.

  1. PopsawayGames

    PopsawayGames

    Joined:
    Jan 2, 2018
    Posts:
    25
    Hi!
    In my previous project ( Unity 2019 ) I used AssetBundles to load all my resources at runtime. My game has the classic download screen at first start, downloading bundles from my server.
    I know that asset bundles prefabs can't have custom script attached, because scripts are packed into DLL when building player and the reference is lost ( although it's possible to do it on Android by tricking with DLL but not possible at all for iOS ).
    I'm now using Addressables for my second project ( still Unity 2019 ) and I packed everything I need to load at runtime into them.
    So...Addressables should be based on AssetBundles if I'm not wrong. I see scripts on prefabs are loaded in editor play mode, unlike AssetBundles.
    So my questions are:
    Is it really possible ( and safe ) to include scripts in Addressables for release on BOTH Android and iOS?
    Does it depends on "Include in build" advanced option?

    Thanks for help!
     
  2. PopsawayGames

    PopsawayGames

    Joined:
    Jan 2, 2018
    Posts:
    25
  3. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    121
    If your prefab script exists, it can run normally, otherwise it can't.