Version: 2020.1
言語: 日本語
public static bool preventCrossSceneReferences ;

説明

他のシーンを指す参照 (cross-Scene references) がエディターで可能かどうかを制御します。

A cross-Scene reference occurs 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.

This is prevented by default because cross-Scene references cannot be saved in Scene files. Therefore, having the Editor prevent you from creating these references avoids potential situations where your assignments cannot be saved. If you need cross-Scene references at runtime, you need to create those references at runtime - finding the GameObjects by values such as name or tag.

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

ただし、この値を無効にしたからと言って、他のシーンを指す参照 (cross-Scene references) が保存可能になるわけではないということに気を付けてください。

この設定を無効にするということは以下のとおりです。

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) lists choices from all open Scenes, instead of just the GameObject's own Scene.
3) Dragging GameObjects from one Scene to another Scene can result in cross-Scene references. Warnings are no longer logged when this happens.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961