- Home /
Connection between 2 scripts
I need to connect the script that adds touch controlls on the camera to the script that controlls the vehicle, but I didn't find anything useful... Can you help me, please?
By GetComponent:
http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html
http://unitygems.com/script-interaction1/
By Events and Delegates (C# only):
http://answers.unity3d.com/questions/600416/how-do-delegates-and-events-work.html?sort=oldest
By Send$$anonymous$$essage:
http://docs.unity3d.com/ScriptReference/GameObject.Send$$anonymous$$essage.html
do you happen to know how can I see which part of the script is doing the action when I press a key?
vague questions make it impossible for people to help you. be as specific as possible and remember to use code tags when posting code.
try posting the code that you've tried - people generally help fix problems, not write it all for you...
Answer by Grim_Darknight · Jul 08, 2014 at 09:44 AM
Create a variable of the vehicle controler's type in the touch script and assign the vehicle control script to that:
public class Vehicle_CTRL : xxxxxxxx
{
/*
Stuff
*/
}
public class Touch : xxxxxxxx
{
public Vehicle_CTRL vehicle;
/*
Stuff
*/
}
Your answer
Follow this Question
Related Questions
Help in Multiplayer 2 Answers
Camera switching : C# onTriggerEnter not working 1 Answer
How do I make a strategy camera go up and down? 1 Answer
Isometric camera skybox not working. 0 Answers
Objectives based on object appear. 2 Answers