Пример #1
0
    //Runs when game Starts
    void Start()
    {
        //Window settings - set window fullsreen at start
        Screen.fullScreen = false;

        //Create a gameobject and attach a MeshFilter.
        //MeshFilter is required to asign and change mesh
        currentObject = new GameObject("GeneratedMeshObject", typeof(MeshFilter));

        //Attach a MeshRenderer as well.
        //MeshRenderer is required to display the mesh and change materials/apparence.
        currentObjectMeshRenderer = currentObject.AddComponent <MeshRenderer>();

        //Set Camera to Examine Mode at start
        viewcamera.currentmode = EditorCamera.Mode.Examine;
        viewcamera.SetExamineTarget(currentObject);

        //User Interfaces
        //Add support for undos
        AddCodeInputfieldsToSupportUndo();
        //Set all the user InputFields to the default values
        SetDefaultValuesToInputField();

        #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
        //We want to check if we had previously saved the project path,
        //Update directory to be the previous project path
        string path = PlayerPrefs.GetString("LastProjectPath", Application.persistentDataPath);
        if (path != "nopath")
        {
            WorkingProjectPath.text = path;
            PopulateProjectbrowser(WorkingProjectPath.text);
        }
        #elif UNITY_ANDROID
        //For Android, The project path will always be "Application.persistentDataPath"
        //This is the path allocated by the android device for the app
        WorkingProjectPath.text = Application.persistentDataPath;
        PopulateProjectbrowser(WorkingProjectPath.text);
        #endif
    }