I’ve tried everything with | Invoke | it doesn’t work that way.Can you tell me something please !
Vector3 vector3 ;
public float x;
void Update ()
{
vector3.x = x;
transform.Translate(vector3 * Time.deltaTime) ;
}
I’ve tried everything with | Invoke | it doesn’t work that way.Can you tell me something please !
Vector3 vector3 ;
public float x;
void Update ()
{
vector3.x = x;
transform.Translate(vector3 * Time.deltaTime) ;
}
I’m not sure how to want/need to call the action. Can you provide more context?
You can try with this:
Vector3 vector3 ;
public float x;
private bool isInvoked;
public void PostponeTranslate() // <- call this to apply translate after a specific delay
{
float timeToPostpone = 2f;// <- set here any time you need/want
Invoke("SetIsInvoked", timeToPostpone);
}
void SetIsInvoked()
{
isInvoked = true;
}
void Update ()
{
if (isInvoked)
{
vector3.x = x;
transform.Translate(vector3 * Time.deltaTime) ;
}
}
It’s not clear what you are trying to achieve, but I find coroutines a very good way to handle postponing or delaying code / instructions.