예제 #1
0
    private void CreatePlacementTool()
    {
        Selection.activeObject = null;
        GameObject obj = prefabBrowser.SelectedPrefab; // This method gives me the selected prefab from the window.

        dummyObject = PrefabUtility.InstantiatePrefab(obj) as GameObject;
        //dummyObject.hideFlags = HideFlags.HideInHierarchy;
        dummyObject.AddComponent <ClickSpawn>();
        ClickSpawn clickSpawn = dummyObject.GetComponent <ClickSpawn>();


        //we send transform data to ClickSpawn
        clickSpawn.setTransformData(tmp_position, tmp_rotation, tmp_scale);
        clickSpawn.setLayer(layerNames[layerSelected], layerSelected);
        clickSpawn.setPhysics(tmp_enable_physics);
        //we send parent data to ClickSpawn
        if (parentObject != null)
        {
            clickSpawn.setParent(ref parentObject);
        }

        clickSpawn.prefab = obj;

        // TO-DO
        // Add parameters to configure the clickspawn component
        // Additional transform settings

        //clickSpawn.layerIndex = 2;
        dummyObject.name = "MVDT_DummyObject";

        MVDUtils.RecursiveSetLayer(dummyObject.transform, 2);
        MVDUtils.ChangeAllMaterials(dummyObject, Resources.Load("mtl_debug_placement") as Material);
    }
예제 #2
0
    private void CreatePlacementTool()
    {
        Selection.activeObject = null;
        GameObject obj = prefabBrowser.SelectedPrefab; // This method gives me the selected prefab from the window.

        dummyObject = PrefabUtility.InstantiatePrefab(obj) as GameObject;
        //dummyObject.hideFlags = HideFlags.HideInHierarchy;
        dummyObject.AddComponent <ClickSpawn>();
        ClickSpawn clickSpawn = dummyObject.GetComponent <ClickSpawn>();

        clickSpawn.prefab = obj;

        // TO-DO
        // Add parameters to configure the clickspawn component
        // Additional transform settings

        //clickSpawn.layerIndex = 2;
        dummyObject.name = "MVDT_DummyObject";

        MVDUtils.RecursiveSetLayer(dummyObject.transform, 2);
        MVDUtils.ChangeAllMaterials(dummyObject, Resources.Load("mtl_debug_placement") as Material);
    }