Exemplo n.º 1
0
    // -------------------------------------------------------------------------------
    // AddScriptingDefine
    // -------------------------------------------------------------------------------
    public static void AddScriptingDefine(string define)
    {
        BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
        string           definestring     = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);

        string[] defines = definestring.Split(';');

        if (UCE_Tools.ArrayContains(defines, define))
        {
            return;
        }

        PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, (definestring + ";" + define));
    }
Exemplo n.º 2
0
    // -----------------------------------------------------------------------------------
    // AutoRegisterSpawnables
    // @Editor
    // -----------------------------------------------------------------------------------
    public void AutoRegisterSpawnables()
    {
#if UNITY_EDITOR
        var guids = AssetDatabase.FindAssets("t:Prefab");
        List <GameObject> toSelect = new List <GameObject>();
        spawnPrefabs.Clear();

        foreach (var guid in guids)
        {
            var path = AssetDatabase.GUIDToAssetPath(guid);
            UnityEngine.Object[] toCheck = AssetDatabase.LoadAllAssetsAtPath(path);
            foreach (UnityEngine.Object obj in toCheck)
            {
                var go = obj as GameObject;
                if (go == null)
                {
                    continue;
                }

                NetworkIdentity comp = go.GetComponent <NetworkIdentity>();
                if (comp != null && !comp.serverOnly)
                {
                    UCE_NetworkSpawnable sp = go.GetComponent <UCE_NetworkSpawnable>();

                    if (sp == null)
                    {
                        toSelect.Add(go);
                    }
                    else if (UCE_Tools.ArrayContains(spawnableCategories, sp.networkSpawnTag))
                    {
                        toSelect.Add(go);
                    }
                }
            }
        }

        spawnPrefabs.AddRange(toSelect.ToArray());

        Debug.Log("Added [" + toSelect.Count + "] network prefabs to spawnables list");
#endif
    }