Version: 5.4

EditorSceneManager.preventCrossSceneReferences

매뉴얼로 전환
public static bool preventCrossSceneReferences ;

설명

Controls whether cross-Scene references are allowed in the Editor.

A cross-Scene reference is when you have multiple Scenes loaded in the Editor, and a component attached to a GameObject in one Scene has a reference to a GameObject in another Scene.

The default value for this setting is True. This means that by default, you cannot create cross-Scene references in the Unity Editor.

The reason this is prevented by default is that cross-Scene references cannot be saved in Scene files. Therefore, having the Editor prevent you from creating these references avoids the situation where your assignments cannot be saved. If you need cross-Scene references at runtime, you need to create those references at runtime - finding the objects by name, or tag, etc.

There are however certain situations where you may need to create cross-Scene references in the Editor - even though these references cannot be saved. A typical use-case for this would be if you needed to create an Editor script which should be able to operate on objects from many Scenes at once. Deactivating this setting allows you to do this.

Note however that deactivating this value does not mean cross-Scene references will be saved.

Disabling this setting means that:

1) Dragging references from a GameObject in one Scene to another GameObject's Component field in a different Scene is allowed.
2) The Object Picker (the small target icon next to most assignable fields in the inspector) will list choices from all open Scenes, instead of from only the GameObject's own Scene.
3) Warnings are no longer logged when dragging objects from one Scene to another Scene which results in cross-Scene references.