Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to move a gameobject

   public static int movespeed = 3;
   public Vector3 userDirection = Vector3.down; //You can change this to any direction
   
   void Update()
    {
        transform.Translate(userDirection * movespeed * Time.deltaTime);
    }
Comment

how to move a gameobject to another object

//Attach this to the oject you want to move
public GameObject Bullet
public GameObject Cannon

void Start()
{
 (Bullet) = GameObject.Find("Bullet"); //These are to find the object to move to
 (Cannon) = GameObject.Find("Cannon"); 
 Bullet.transform.position = Cannon.transform.position; //this is to move the object
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# dictionary initializer 
Csharp :: c# foreach dictionary 
Csharp :: c# remove special characters from string 
Csharp :: How to create connection string dynamically in C# 
Csharp :: convert comma separated string to array c# 
Csharp :: unity movement 
Csharp :: how to make a mouse down condition in unity 
Csharp :: console.writeline c# 
Csharp :: clear controls from panel c# 
Csharp :: keybyvalue c# 
Csharp :: unity cos 
Csharp :: how to remove all buttons on a form C# 
Csharp :: two variable in one loop in one line c# 
Csharp :: system.drawing.color from hex 
Csharp :: c# initialize empty array 
Csharp :: simple player controller unity 
Csharp :: google sheet script change text color 
Csharp :: get enum name 
Csharp :: What is the difference between String and string in C#? 
Csharp :: c# remove character from string at index 
Csharp :: unity stop animation from playing at start 
Csharp :: order by length descending C# 
Csharp :: 2 rotation unity 
Csharp :: unity button onclick 
Csharp :: c# run cmd hidden 
Csharp :: shorthand if c# 
Csharp :: c# return list in descending order 
Csharp :: variable gameobject unity 
Csharp :: length of array c# unity 
Csharp :: wpf color picker 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =