Search Unity

No More Cross Scene References?

Discussion in 'Scripting' started by apiotuch, May 6, 2018.

  1. apiotuch

    apiotuch

    Joined:
    Oct 8, 2009
    Posts:
    42
    So I just downloaded the release of 2018.1 and I noticed that when I have two scenes open, I can no longer reference a GameObject from one scene into a public field on a GameObject in another scene.

    Is there anyway to to disable this behavior, via an attribute or some preference setting in Unity? I know when the scene with the source GameObject is unloaded, the reference is lost in the other scene; but I actually developed a solution around that.

    Anyone from the Unity dev team with an answer as to why it is blocked now? I just seems like it is more restricting than helpful.
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,528
    I would believe this should answer your own question:
    It's not supported, you had to write a work around to get it supported.

    Unity on the other hand probably just was like "we should stop doing this, since the connection will be lost, which may confuse some people".

    Because by allowing the cross-reference, it sort of implies that it should work. When it doesn't. Noting that the multi-scene editing is a very new feature and is sort of considered 'beta'ish. So yeah, changes are to be expected.

    ...

    If you have a work around. You must have a way to find the reference in the 'other' scene. Just modify that to work in the editor scene as well. You may have to write a PropertyDrawer that allows the drag and drop to grab that reference.
     
    Joe-Censored and Bunny83 like this.
  3. apiotuch

    apiotuch

    Joined:
    Oct 8, 2009
    Posts:
    42
    Ya it seems it is the case that I will have to write something. It turns out I was using another asset to unlock the drag and drop, but I didn't realize it until now. I did manage to get cross scene references to work really well even built in the option to load the source scene in edit mode by a button click on the 'lost reference'. I will try to figure out how to use a property drawer to unlock it. I would like to develop it further and drop the asset on the store but I won't do it until I can do it without the other asset's dependency. It completely frees development and eliminates the need for managers. Maybe the Unity dev team can help me out on unlocking that restriction.
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,141
    Furgl, Whatever560 and apiotuch like this.
  5. apiotuch

    apiotuch

    Joined:
    Oct 8, 2009
    Posts:
    42
    Yes! Thank you Ryiah that is exactly what I was looking for.
     
  6. Slodki_Piesek

    Slodki_Piesek

    Joined:
    Jun 15, 2021
    Posts:
    1
    how do i use it?
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,686
    Please don't necro-post vague questions to ancient threads without at least adding new information.

    If you have a problem, start your own post, it's FREE.

    When you post, remember that nobody here can read your mind, so you must communicate clearly.

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220

    If you post a code snippet, ALWAYS USE CODE TAGS:

    How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/