- Home /
calling c# method from different c# file
i need to call public void DestroyJoint() which is in BawlSwing.cs and i have to call this from my c# file called Reset
if you guys could help me out with the line of code i need that would be great thanks
Is BawlSwing a static class (meaning you don't instantiate game instances of it)? I'm assu$$anonymous$$g Reset is a static class right?
Are those monobehaviour classes or something else?
Answer by J3-Gaming · Sep 23, 2011 at 11:47 PM
Add this bit of code into your script, and drag the object that has BawlSwing attached in the inspector to the object that has the reset script attached.
public class Reset: MonoBehaviour
{
public BawlSwing bawlSwing;
public void Awake()
{
bawlSwing.DestroyJoint();
}
}
Your answer
Follow this Question
Related Questions
Using method from main class in custom class 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How can I use something like Invoke() to call a method in another class? 1 Answer
Combine two scripts 0 Answers