2. Unity3D
• Utilizando Mapas = Novas Cenas
• Novas cenas:
• Diferentes fases do jogo
• Cenas para menus
• Evita demora na carga inicial
• Edit -> New Scene...
• File -> Save Scene (nome)
3. Unity3D
• Nova Scene:
• Cenário vazio
• Todos assets do projeto acessíveis
• (project view : lista assets)
• Classe Application
• Carregar mapas
• Informações gerais (aplicativo)
• url, Playing / editor, streaming...
4. Unity3D
• Application.LoadLevel(mapa)
• Leitura por índice do mapa
• Número direto*
• Leitura por nome da Scene
• Código básico carregar mapa:
if (Input.GetKeyDown("1")) {
Application.LoadLevel("menu01");
// ou
Application.LoadLevel(1);
}
5. Unity3D
• Mapas precisam estar listados no
Build
• File -> Build Settings
• Add Current
• Lista de mapas no projeto
• (índices a direita)
• Adicionar novo mapa e testar
troca mapas
7. Unity3D
• Classe Application : Funções
• .LoadLevel()
• Por nome ou índice
• .Quit()
• Ignorado no Editor e no WebPlayer
• .CaptureScreenShot()
• Application.CaptureScreenshot(“teste.png”);
• .OpenURL()
• Application.OpenURL(“http://invent4.com”);
8. Unity3D
• Criando o Build
• Inicia na Scene (0)
• Web Player
• Gera .Unity e .Html
• Rodar por browser
• HTML pode ser modificado
(template básico)
9. Unity3D
• OS X = versões Mac
• Windows Standalone = Executável PC
• Executável + Folders
• Necessário Sub-diretórios para rodar
10. Unity3D
• Player / EXE = Settings
• Edit -> Project Settings -> Player
• Nome autor
• Nome Programa
• Configurações Default Vídeo
• Executável (Standalone)
• Display Resolution Dialog
• Configurações iniciais, display e
teclas, diretamente funcional no
jogo
11. Unity3D
• Possível criar imagem para o
Dialog Inicial
• Assets->Import new asset...
• Imagem básica (440x170)
• Atribuir imagem: Dialog Banner
• Possível usar ou não esse
config inicial
12. Unity3D
• WebPlayer Streamed
• Carregar por demanda, enquanto joga
• Usando Streamed, necessário verificar se Scene
disponível:
if (Application.CanStreamedLevelBeLoaded (levelToLoad)) {
Application.LoadLevel (levelToLoad);
}
13. Unity3D
• WebPlayer Streamed
• Possível acompanhar Status de carregamento
GetStreamProgressForLevel() (0...1)
• Carregar Stream enquanto joga (assíncrono)
Application.LoadLevelAsync(level)