Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Adding scripts to addressables

Discussion in 'Addressables' started by gerasmussen, Jun 21, 2021.

  1. gerasmussen

    gerasmussen

    Joined:
    May 27, 2021
    Posts:
    32
    Hi all, I am wondering if it possible to add a script to game objects that are addressable. In my case, I would like to add a script that will highlight objects when clicked and make them moveable around the scene so that the user can put them where they would like within the scene. I would like all of my stored addressable game objects to be able to follow this same script that I create. If there is a solution, how should I begin? Thanks in advance.

    UPDATE: I have found a solution to the movement, but can only get children to move on their own. How do I get the entire system to move together?
     
    Last edited: Jun 21, 2021
  2. This has nothing to do with Adressables.

    - you can have scripts on addressable assets
    - you cannot have code in addressables, all scripts on addressable objects will be in the normal assemblies
    - you can't add new functionality through addressables
    - you can do everything normally just like you haven't used addressables otherwise, so you can move your loaded objects by any means you can move the other objects
    - moving multiple game-objects is easy, move one gameobject normally (like you would do without the rest of the objects), calculate the delta between the previous position and the new position then move the rest of the objects by this delta
     
    IggyZuk likes this.