CategoryUncategorized

How to add an audio file to a button in Unity3D

H

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

H

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 make an AI Enemy Car in which it follows the track during the Race ?

H

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

W

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...

CActive Object in Symbian C++

C

Active Object provides a support for asynchronous process. let’s see example of Timer using CActive :- Active Object can be implemented by deriving from the CActive class void CTestTimerAO::RunL()//RunL-The handler function to be invoked by the active scheduler when the request completes { iTimeString = _L(“”); iMs = iMs + 1; TUint64 minute; TUint64 second; TUint64 millisecond;...

Movement from Unity 3d into Unity 3D iOS or Android

M

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...

Category