private void CheckForVTManager() { if (!viewToolManager) { Debug.Log("View Tool Manager Window is missing a referance to the View Tool Manager on the Scene"); viewToolManager = FindObjectOfType <CS_ViewToolManager>(); // cant find a vtm on the scene if (!viewToolManager) { // if there is a linked VTMEditorSettings file if (vTMEditorSettings) { GameObject newVTMSceneGO = Instantiate(vTMEditorSettings.VTMScenePrefab); viewToolManager = newVTMSceneGO.GetComponent <CS_ViewToolManager>(); Debug.Log("No View Tool Manager on the scene, adding one from the Editor Settings file"); } else { Debug.LogError("No View Tool Manager on the scene and VTMEditorSettings file is missing"); } } else { Debug.Log("Found View Tool Manager on the scene"); } } // check for raycast checkers on view tool manager CheckForRaycastersOnVTM(); }
public void SetupViewMeshGenerator(CS_ViewToolManager vtManager, CS_RaycastChecker rChecker, Color mColor) { viewToolManager = vtManager; toolUserSettings = viewToolManager.ToolUserSettings; connectedRaycastChecker = rChecker; // get the mesh filter meshFilter = GetComponent <MeshFilter>(); // create a new mesh mesh = new Mesh(); // set the mesh to the mesh filter meshFilter.mesh = mesh; meshRenderer = GetComponent <MeshRenderer>(); // set mesh transparency transparency = meshRenderer.material.color.a; // set the mesh color meshColor = mColor; meshColor.a = transparency; meshRenderer.material.color = meshColor; // send some quick mesh data to make a triangle for testing Vector3[] testTriangleVerts = new Vector3[] { new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.0f, 1.0f, 1.0f), new Vector3(1.0f, 1.0f, 0.0f) }; int[] testTriangleTris = new int[] { 0, 1, 2 }; UpdateMesh(testTriangleVerts, testTriangleTris); ClearMesh(); }