Here’s my problem:
Script in non-Rigidbody2D object:
protected Rigidbody2D current;
public void MyFunction (bool check, GameObject obj) {
current = obj.GetComponent<Rigidbody2D>(); //error CS1061 here
if (check) {
current.position = Vector2;
} else {
current.position = Vector2.zero;
}
}
Script on Rigidbody2D object:
public Non-Rigidbody2DScript script;
void FixedUpdate(){
script .MyFunction(true, this);
}
As i saw using Debug.Log, the this in the Object referencing a Object type, not a GameObject… then the question:
How i reference in function call in the Rb2D object itself with the GameObject reference? (or what i’m doing wrong in all this)