Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Initialize Project Script

mika edited this pageApr 5, 2024 ·5 revisions

You can use custom project initialization scripts (these are copied into New Project and executed at first launch).

Quick Start

  • Press FETCH button to download my ready to use sample init script fromhttps://github.com/unitycoder/UnityInitializeProject/tree/main/Assets/Editor
  • Confirm that it was downloaded by pressing [...] button (it should open Scripts/ folder next to unitylauncherpro.exe) and that folder should contain "InitializeProject.cs" file
  • Enable [x] Use Init script, by checking that box
  • Now create new test project from Projects or Editors tab
  • Once Unity editor launches, it should display this init script window: *I have added Hot Reload here manually as commonly used package
    image
  • Press Setup Project and the initialize script will do your setup automatically (based on my sample script, which currently does these things, listed here:https://github.com/unitycoder/UnityInitializeProject?tab=readme-ov-file#current-features
  • After init script has completed, it will delete itself

Customization Guide

  • If you want to make your own init script, you can modify my base scripthttps://github.com/unitycoder/UnityInitializeProject/blob/main/Assets/Editor/InitializeProject.cs
  • You can assign your new local InitializeProject.cs location in that field or add online hosted script URL (and press Fetch to download it)
  • NOTE: if you use your own scripts, make sure the NameSpace is "UnityLauncherProTools", Class is "InitializeProject", and Method is "Init"
  • You can assign your commonly used .unitypackages in the Init Script window (Click Select Assets). These values are saved into EditorPrefs

EXAMPLE SCRIPT (creates initial folders for new project)

usingSystem.Collections;usingSystem.Collections.Generic;usingSystem.IO;usingUnityEditor;usingUnityEngine;namespaceUnityLauncherProTools{publicclassInitializeProject{// settingsstaticstring[]folders=newstring[]{"Fonts","Materials","Models","Prefabs","Scenes","Scripts","Shaders","Sounds","Textures"};staticstringassetsFolder;[MenuItem("Tools/Initialize Project")]publicstaticvoidInit(){assetsFolder=Application.dataPath;CreateFolders();// TODO adjust project settings, linear, company name// TODO remove extra packages// TODO setup light settings// TODO adjust mainscene: camera pos, skybox off?// TODO save mainscene// TODO add mainscene to build scenes list// TODO adjust quality settings (but only in mobile?)// TODO self destruct this editor script file?// refresh folderAssetDatabase.Refresh();}staticvoidCreateFolders(){// create each folder if it doesnt existsforeach(stringfolderinfolders){if(!Directory.Exists(assetsFolder+"/"+folder)){Directory.CreateDirectory(assetsFolder+"/"+folder);}}}}}
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp