Jump to content
  • Advertisement
Sign in to follow this  
Simla

advance enemy

This topic is 524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am playing Unity 2D, I wrote the following code to advance the enemy, but when I play the game the enemy does not advance or even disappears

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Dusman : MonoBehaviour {
    public Transform hedef;
	void Start () {
        hedef = GameObject.FindGameObjectWithTag("Player").transform;
	}
	void FUpdate() {
        
        transform.LookAt(hedef);
        transform.position += transform.forward * 2 * Time.deltaTime;
        
    }
}

Share this post


Link to post
Share on other sites
Advertisement

Shouldn't that be "FixedUpdate()" instead of "FUpdate()"?

I did that later on Update () but it does not work

Share this post


Link to post
Share on other sites

 

Shouldn't that be "FixedUpdate()" instead of "FUpdate()"?

I did that later on Update () but it does not work

 

So you are saying that the code you posted is not your actual code that's running?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!