public static void unregister_me(int token, ProgressiveMeshRuntime rtm) { if (lod_queues != null) { lod_queues[token].Remove(rtm); } }
private void CreateReplacePrefab(string meshPath, string preFabPath, ProgressiveMesh progMesh, int iteration) { string newPathMesh = meshPath.Replace(Application.dataPath, "Assets"); string newPathPrefab = preFabPath.Replace(Application.dataPath, "Assets"); string finalMeshPath = newPathMesh + "/" + meshFbxFiles[iteration].Name; string finalPrefabPath = newPathPrefab + "/" + progMeshes[iteration].name.Replace("_Progressive_Mesh", "") + addedToFilename + ".prefab"; GameObject objToPrefab = null; ProgressiveMeshRuntime progMeshRun = null; try { objToPrefab = AssetDatabase.LoadAssetAtPath(finalMeshPath, typeof(GameObject)) as GameObject; } catch (UnityException e) { Debug.Log(e); } if (objToPrefab == null) { var sceneObj = PrefabUtility.CreatePrefab(finalPrefabPath, objToPrefab, ReplacePrefabOptions.ReplaceNameBased) as GameObject; SetSettings(sceneObj, progMeshRun, progMesh); } else { var sceneObj = PrefabUtility.CreatePrefab(finalPrefabPath, objToPrefab, ReplacePrefabOptions.ReplaceNameBased) as GameObject; SetSettings(sceneObj, progMeshRun, progMesh); } }
public static int register_me(ProgressiveMeshRuntime rtm) { init_all(); int token = (int)(UnityEngine.Random.value * (max_lod_queue_count - 1)); lod_queues[token].Add(rtm, rtm); return(token); }
private void SetSettings(GameObject sceneObj, ProgressiveMeshRuntime progMeshRun, ProgressiveMesh progMesh) { if (sceneObj != null) { progMeshRun = sceneObj.AddComponent <ProgressiveMeshRuntime>(); if (progMeshRun != null) { progMeshRun.progressiveMesh = progMesh; if (useRuntimeSettings) { progMeshRun.cullRatio = cullRatio; progMeshRun.intensity = lodIntensity; //progMeshRun.lodLevels = lodLevels; progMeshRun.manualMode = manualMode; progMeshRun.maxLod = maxLod; progMeshRun.minLod = minLod; progMeshRun.runInEditor = runInEditor; progMeshRun.notes = notes; } } else { Debug.LogError(string.Format("Failed to add ProgressiveMesh Runtime Component to: {0}", sceneObj.name)); } AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); } else { Debug.LogError(string.Format("Failed to create new prefab instance for: {0}", progMesh.name)); } }