LEARNING UNITY
Initialize Project For Android
[Link] Of all goto build Profile and switch platform to android.
[Link] -> Set product -> Resolution and Presentation -> Orientation
[Link] a Pause Menu
Make a pause menu with buttons. And hide it using tick before its name
Make one Empty GameObject Link It with script
Add Functions to Script for Enable/Disable Pause Menu
using UnityEngine;
using [Link];
public class UiManager : MonoBehaviour
{
public GameObject pauseUI;
public void OnRestart()
{
[Link]([Link]().name); //Reset Game
}
public void OnGameResumePress()
{
[Link](false); //Hide
}
public void OnGameExitPress()
{
[Link](); //Exit Application
}
public void OnEnterPausePress()
{
[Link](true); //UnHide
}
}
Explanation:
GameObject pauseUI; Will be visible at GameObject Empty (UiManager in this case) So Drag
the pause menu to it.
Assign Each Function To respective Buttons
Using Functions we can control its visibility.
So We also want when pause is on every other things are disable
So add an image (Dark) to fill whole screen with black color and low opacity
LEARNING UNITY
Place dark above Pause menu (lower object closer and upper are farthest)
Now Make Pause Menu child of dark and drag dark on UiManager(Empty) pauseUI
If you disable raycast target under image in dark then all other things will be
enable.
[Link] Align
When you have 3-4 buttons and you want to align them then and Empty name
it (eg Menu Buttons) then add component vertical layout Group and insert all
buttons inside Menu Buttons.
Add image component in Menubutton set color then in vertical layout Group
check control child size width and height then add padding.
[Link] canvas
For Horizontal (height) and for Vertical (widgth)
[Link] Show and Hide Without Code
LEARNING UNITY
Select a button a make two onclick() event one for activating a panel and second hiding any
other object which shouldn’t be shown when this object is active.
On 1st event place Drag Panel to None object , so it will be visible on click then choose
function -> gameObject -> setActive(bool) and check it .
Similarly uncheck the second one.
AR Application
[Link] canvas and inpector->canvas scaler->UI scale mode->Scale with screen size
[Link] background (stretch it out using anchor->alt->right corner bottom block) and title (if
title is a image then inspector->image->set Native then change size from rect transform->
scale)
[Link] image for icons and adjust them . Now select all images and add Component-> Button
Switch Between Scene
Create New Script name it.
using UnityEngine;
using [Link];
public class SceneController : MonoBehaviour
{
public void SwitchScene( string sceneName)
{
[Link](sceneName);
}
[Link] add this script above add component on buttons Parent Block
[Link] all Buttons or Icons and add onclick() . Then Drag That Parent Component to None
Object.
[Link] function -> SceneController -> SwitchScene Then Write Scene Name below
Function name which is the string Required.
[Link] file -> Build Profile -> Open Scene List (right side) -> add scene -> drag all scenes
Rotate Earth
Create New Script name it.
Add this code to script
using UnityEngine;
public class RotateEarth : MonoBehaviour
{
public GameObject PlanetObject;
public Vector3 RotationVector;
LEARNING UNITY
private void Update()
{
[Link](RotationVector * [Link]);
}
}
Now Add script above add component of earth and set its PlanetObject By dragging Earth
then SET the Y axis to 10 for Movement.
Add Canvas To AR Scene
[Link] Canvas to scene and then add UI .
Add texture
[Link] Material Folder under which right click->create->Material then drop that material
onto the object and click on small circle before Base Map name and select texture.