this is code used to play the video in iphone using unity 3d using UnityEngine; using System.Collections; public class IntroMovie : MonoBehaviour { void Start () { iPhoneUtils.PlayMovie(“CINEMATIC_WITH_MUSIC.mp4”,Color.black, iPhoneMovieControlMode.CancelOnTouch,iPhoneMovieScalingMode.AspectFit); } } one important thing in order to play video files it should be placed in...
Screen Orientations Methods in unity3d
There are 3 types of orientation in Rotate only landscape public void AutoOrientToLandScape() { if(Vector3.Dot(Input.acceleration.normalized,new Vector3(1,0,0)) > 0.45) { Screen.orientation=ScreenOrientation.LandscapeRight; } else if(Vector3.Dot(Input.acceleration.normalized,new Vector3(-1,0,0)) > 0.45) { Screen.orientation=ScreenOrientation.LandscapeLeft; } } Rotate only Portrait public...
How to make scoring system with animated stars
it can be done by using iTween method. The plugin is available in asset store and its free.
In this we can use fadein or fadeout method for blink of stars in the game.
if u use this no need of animation
How to import an image using WWW in unity3d
Try this method i hope i will help full
public Texture2D tDynamicTx;
public WWW tLoad;
public string images;
images =”;;
tLoad= new WWW(images);
tDynamicTx= new Texture2D(64, 64);
tLoad.LoadImageIntoTexture(tDynamicTx);
GUI.Label(new Rect40,40, 64, 64), tDynamicTx);
How to add an audio file to a button in Unity3D
using UnityEngine; using System.Collections; using System; public class MainMenu : MonoBehaviour { public AudioSource audioSource; public AudioClip palySound; void Start () { } public void OnGUI() { if(GUI.Button(new Rect(50,200,100,45),”Play”)) { audioSource.PlayOneShot(palySound); } }} when we attached the script in the inspector. we have to attach the AudioSource from the...
How to Create Write and Read a file in iphone without using playerprefs in unity3d
it is not that easy to read or write file in iphone we have to give the specific path in order to read or write. here is the sample code using UnityEngine; using System.Collections; using System.IO; using System.Text; public static class GameManager { private static string path; public static void starting () { path = Application.dataPath.Substring (0, Application.dataPath.Length - 20...
how to rotate the AI car according to the Track/Road in Unity3d
The following link it would be helpfull
How to make an AI Enemy Car in which it follows the track during the Race ?
The AI for enemy car can be done by using waypoints method.. the following code is used var waypoint : Transform[]; var speed : float =20; private var currentWaypoint : int; var loop : boolean = true; function Awake() {waypoint[0]=transform;} function Update () { if(currentWaypoint < waypoint.Length) { var target : Vector3 = waypoint[currentWaypoint].position; var moveDirection : Vector3 =...
Weird movment of character in Unity3D
Question:I imported a simple 3d model from which I construtected a terain. For a test I use box(mesh), but movment is really weird like that models would be realy bumpy. Because of that I also tryed to switch my models with unity meshes but it’s same Answer:In ur game select cube in that u have added rigidbody. In Rigidbody select the constraints in that u will see freeze rotation...
Movement from Unity 3d into Unity 3D iOS or Android
if u want to using buttons use this it will work in unity 3d and ios void OnGUI() { if(GUI.RepeatButton(new Rect(50,210,40,40),"up")) { transform.Translate(Vector3.forward*Time.deltaTime*50); } if(GUI.RepeatButton(new Rect(50,280,40,40),"down")) { transform.Translate(Vector3.back*Time.deltaTime*50); } if(GUI.RepeatButton(new Rect(10,250,40,40),"left")) { transform.Rotate(Vector3.down, 90*Time...