Search Unity

Magic Auto Linker

Discussion in 'Assets and Asset Store' started by Xtro, Dec 5, 2014.

  1. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Hi guys.

    Few days ago I published "Magic Auto Linker" on asset store. It's a runtime component which automatically links your game objects to your scripts so you don't have to drag & drop hundreds of game objects constantly during the development of mid and big sized projects. I had this problem for all my projects so I had to create this component and I wanted to share it with everyone.

    Since the component is runtime only, it doesn't mess with your scene or project structure in anyway. When you start the play mode, it links the game objects to your script references so you don't get a null exception because you forgot to drag & drop it after you declare the reference in your code.

    All you need to do is decorating the references with [AutoLink] attribute in your code and attach the AutoLinker component onto the game object.

    This is my first professional unity asset. You can use this forum post or you can directly email me for your questions and support requests.

    Story time :)
    (My paraphrasing from Stephen Hawking's article. For original : Link)

    In the beginning, there was only darkness, water, and the great god Bumba. One day Bumba, in pain from a stomach ache, vomited up the Visual Basic. Still in pain, Bumba vomited up the Delphi and other visual programming environments.(Please see the documentation for the entire story...)

    Asset Store Link: https://www.assetstore.unity3d.com/en/#!/content/25768
    Lite (Free) version : https://www.assetstore.unity3d.com/en/#!/content/25770

    Documentation: https://docs.google.com/document/d/1hCXerp9d1OQlYknq5roHTgNa9YUYg3jIoLuurTUhELA

    Preview mode:

    Magic Auto Linker also introduces a preview window for you to be able to see the possible links between your scripts and game objects so you can make sure that the magic is working :)

    As you can see in the screen shot, Magic Auto Linker supports collections (arrays and lists) and sub-classes in your scripts.

     
    Last edited: Oct 4, 2015
  2. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
  3. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    This asset is a gift !
     
    Xtro likes this.
  4. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Thank you very much. It's amazing to see that someone out there gets benefit from my work :)
     
  5. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Magic Auto Linker is updated for Unity 5.
     
  6. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    What are the limitations? I see you assign them in Start, so they can't be used in Awake?
     
  7. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    How does it know which scene item is to be referenced, in case when more than one similar item is present in the scene ?
     
  8. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    1) They can be used in Awake because AutoLinker runs in Created event (by the help of WeNeedCreatedMessage system)
    2) Which file and line do you refer when you say "I see you assing them in Start"? As far as I remember, I don't assign anything. I just use them. Assignment is done by AutoLinker. Oh you mean the execution time of AutoLinker? As I said in number 1, it runs in created event just before Awake.
     
  9. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    AutoLinker searches for objects which are parented by itself.
     
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    How does it know which of the found to pick, if they have the same name for example ?

    Lets say script A references a Enemy object in the scene and script B references a different Enemy object in the same scene.

    How is it possible to tell script A to pick the first Enemy and not the one that script B is to use
     
  11. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Hi again. AutoLinker component processes the other scripts which are attached to the same gameobject along with itself and it can only links child objects to those scripts. It doesn't search for entire scene.

    If there are multiple objects with the same name and type, it chooses the first one.

    Did you examine the example scenes? If they couldn't help you, I can try to explain more.
     
  12. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    Thanks for the help. I dont have the asset yet, i try to understand what it does exactly to see if i can use it in my project.

    I think i got what it does now, the items are specific and are just not needed to be dropped in the scripts referenced, which is cool.
     
  13. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Oh you don't have it yet. You can try the free version. Pro version has some additional features like arrays and sub classes but in most cases, free version should be sufficient. I didn't make this asset to earn money. I made it because I needed it. I hope it can help you too.
     
  14. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Hi, I notice I cannot place Atest in the Plugins folder, it says AutoLinker is inaccessible
     
  15. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Unity's plugins folder is for native plugins. AutoLinker is not a native plugin. You shouldn't put it into plugins folder. But it's ok to put it under a folder like "3rdParty" or something. If you still have problem, please send me a screenshot of the project folder structure and the error message itself.

    Thank you for trying AutoLinker :)
     
  16. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Putting plugins is to make sure the code is compiled once, not only for natiive plugins. I have all third party packages in Plugins folder fine, not sure why Atest don't work.

    Can u pm me your email, I'm setting up for UI and the autolink preview window does not show it being linked.
     
  17. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Found the problem, it does not support static variables. But now, after I changed the variable to non static, the preview window keeps generating OutOfRange exception, and don't draw properly.
     
  18. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    If I place the AutoLinker on a gameobject called UI, it will have IndexOutOfRange exception. I see you are doing some reflection and it got confused?
     
  19. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Sorry, I was late to respond. My email is onurer@gmail.com

    If you can isolate the problem into a small and empty project, it would be easier for me to solve it.
     
  20. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548