|
I wanted to create a script, that moves an object in one direction and changes the direction of the movement every three seconds. But it returns error. Could you please see what is wrong here? Error is: 1)Assets/Blind_Scripts/Random_2D_Movement.js(35,16): BCE0070: Definition of 'Random_2D_Movement.WaitAndStart' depends on 'Random_2D_Movement.ChangeDirection' whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle. 2)Assets/Blind_Scripts/Random_2D_Movement.js(35,15): BCE0023: No appropriate version of 'UnityEngine.MonoBehaviour.StartCoroutine' for the argument list '(unknown)' was found.
(comments are locked)
|
|
Ok, I reviewed your script just by head so try and report any error so that we can fix it. Thank you so much, I see now what a mess my script was) This one works perfectly!
Apr 10 '12 at 10:48 AM
Makiavel
I'm sorry, but I've got another question. Is there a way to point an object of script in the direction of movement? I can not find a way to use a current Vector3 as a looking direction, not via LookAt, not via Rotate functions...
Apr 11 '12 at 11:23 AM
Makiavel
Do you mean you can figure out LookAt()? target:Transform; // drag your target object in the inspector function Update(){ transform.LookAt(target); } Or explain a little more I did not quite get what you meant.
Apr 11 '12 at 01:17 PM
fafase
I mean that I am trying to make the object, that I attach this script to, face in the direction of the movement. And each time the direction of movement changes, so does the facing direction. And so on...
Apr 11 '12 at 02:49 PM
Makiavel
"I wanted to create a script, that moves an object in one direction and changes the direction of the movement every three seconds." I am lost, that is what you wanted but now you don'ty want it?
Apr 11 '12 at 03:32 PM
fafase
(comments are locked)
|
Well , I tried to review with the information I understood, now you get a random position on the map to where the guy is heading. It changes every 3 seconds.
(comments are locked)
|

When you post, highlight the code part and press 101010 to make it easier to read. Also, you should post the error so that it can be fixed faster if we already know where it is wrong.
Your problem is that one function relies on the other while the other has not yet given any result. the second error is telling you that you call a function that does not exist.