Exemple #1
0
        internal void DependOnGameObject(GameObject dependent, GameObject dependsOn)
        {
            if (!_isLiveLink)
            {
                // this dependency only needs to be tracked when using LiveLink, since otherwise subscenes are converted
                // as a whole.
                return;
            }


            if (dependent == null)
            {
                throw new ArgumentNullException(nameof(dependent));
            }
            if (ReferenceEquals(dependsOn, null))
            {
                // It is essential that we early out here. Due to the way that null-ness works in Unity, we can still
                // work with the data we get even if it is null to extract the instance ID. This means that we should
                // *not* blame the user when they pass a null-value in here, because they will probably not use
                // ReferenceEquals but stick to == null, which then means we cannot extract the instance id anymore.
                return;
            }
            GameObjectDependencyTracker.AddDependency(dependent.GetInstanceID(), dependsOn.GetInstanceID());
        }
Exemple #2
0
        internal void DependOnAsset(GameObject dependent, Object dependsOn)
        {
#if UNITY_EDITOR
            if (dependent == null)
            {
                throw new ArgumentNullException(nameof(dependent));
            }
            if (ReferenceEquals(dependsOn, null))
            {
                return;
            }
            if (dependsOn != null && !dependsOn.IsAsset() && !dependsOn.IsPrefab())
            {
                return;
            }

            int dependentId = dependent.GetInstanceID();
            int assetId     = dependsOn.GetInstanceID();
            AssetDependencyTracker.AddDependency(dependentId, assetId);
#endif
        }