Search Unity

UNSOLVABLE Build vs. Editor Script Error (God please help)

Discussion in 'Editor & General Support' started by AirEnderman, Jul 23, 2019.

  1. AirEnderman

    AirEnderman

    Joined:
    Jul 23, 2019
    Posts:
    1
    (Context: All code is in C#)

    So I'm working with a small team on this fan project. Some time ago, our lead programmer just wanted to see how the project would run as a final distributable build (just for testing). Well, when trying to do this, he encountered the error message:

    "you are referencing an object in a public property of a script that was generated dynamically in the editor. This happens easily on scripts that can run both in editor and at runtime."

    He says that when he tries to instantiate a prefab and then getcomponent on said instance, he's met with the above error. The programmers have worked tirelessly and have reached out to outside teams to try to find a solution to the issue, but we haven't found anything. I figured all I can do at this point is reach out to the community here and hope someone really in-the-know knows what is happening here.

    He's also said that the soon-to-be Entity Component System upgrade might help with the issue if we just copy over our scripts with a few changes, but we could use a solution with what we have now.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You're probably doing exactly what the error message says. I'm guessing you're doing something with scriptable objects, not just instantiate prefab and getcomponent. Hard to guess if you don't want to show the code which causes the error.

    For the record, you should be regularly creating builds as part of development/testing. You'd catch these kinds of issues immediately and know exactly what changes caused the problem, also they are the only way to do any performance testing.

    As for ECS/DOTS, it is basically an entirely new way of developing games with Unity. So yes there is a high likelihood it could resolve this problem.... in the same way that converting your car into a hovercraft would fix a flat tire. That's a bit extreme for fixing a flat though, same here.