last day (15 days later) » 

06:23
0
A: How to Call SetPoints function from another class

Mohammad Faizan KhanThere are different ways, Drag and drop script public class YourOtherClass : : MonoBehaviour { public MoveTowards moveTowards;//assign by drag and drop in inspector void Start () { moveTowards.SetPoint(); } } Attach your other script on same Gameobjec...

as you suggested i tried drag and drop getting the following error : error CS1061: Type MoveTowards' does not contain a definition for index' and no extension method index' of type MoveTowards' could be found. Are you missing an assembly reference?
This error occurs when you try to call a method or access a class member that does not exist.
can you share complete error.
Assets/Swipe.cs(111,29): error CS1061: Type MoveTowards' does not contain a definition for index' and no extension method index' of type MoveTowards' could be found. Are you missing an assembly reference?
that error was by my mistake but after adding script also my code is not working
share swipe script
ok
public class Swipe : MonoBehaviour {

public float minSwipeDistanceY;

public float minSwipeDistanceX;

private Vector2 startPosition;

public Image image1,image2,image3,image4;

public Transform agent;

public MoveTowards moveTowards;

public static int index = 0;
private int value;

// Update is called once per frame
void Update () {


Debug.Log("update called");
if (Input.touchCount > 0)
{

Debug.Log("touchCount>0");

Touch touch = Input.touches[0];

switch (touch.phase)
{
case TouchPhase.Began:
06:28
index = index + value
where is index variable define?
I guess you should need to learn programming first
error occuring due to index variable which you didn't define. did you copy paste the code
look at the script
its defined at starting
are you blind or what
i have not copied the code its mine only
actually question i asked was wrong
my problem was different
that's why your answer is right for this question
thanks
Yes maybe your questino were and behavior too
anyway best of luck

last day (15 days later) »