how to reference function in unity
public GameObject myObject; //make ref. in inspector window
myObject.GetComponent<MyScript>().MyFunction();
how to reference function in unity
public GameObject myObject; //make ref. in inspector window
myObject.GetComponent<MyScript>().MyFunction();
how to make a function unity c#
Void Start()
{
//call a void function (will return nothing/null)
MyVoidFunction(false);
debug.log(MyIntFunction(7));
}
Void MyVoidFunction(bool n)
{
if(n)
debug.log("Void Function Ran, n is true")
if(!n)
debug.log("Void Function Ran, n is false")
//if you get an error here do
//return;
}
int MyIntFunction(float x)
{
return x * 2;
}
functions unity
NumValue = 6;
int myfunc(int num){ // Optional int(s) Go In Parentheses
// Any Given Code Goes here. If You Want to Use ints, use int name.
// I Don't know the name for this so i will call it the function description
}
myfunc(NumValue); // Will Run Any Given Code Placed Inside The function description
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us