Question by
Chocolade · Mar 18, 2018 at 04:53 AM ·
c#scripting problemscript.
How can I give each instance a enum mode from another script ?
In the first script:
private void WP()
{
for(int i = 0; i < instancesToMove.Length; i++)
{
instancesToMove[i] = WaypointsBehaviour.PathCompleteBehaviour.Loop;
instancesToMove[i].GetComponent<WaypointsBehaviour>()
}
}
instancestoMove is GameObject[] array
In the second script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WaypointsBehaviour : MonoBehaviour
{
public enum PathCompleteBehaviour
{
Stop,
Loop,
Reverse,
ChangeDir,
Random,
PingPong,
Curve
}
[Header("Path Behaviour")]
[Space(5)]
[Header("Waypoints")]
public GameObject[] waypoints;
private void Start()
{
}
private void Update()
{
}
}
What I want to do in the first script is that I will be able to give each gameobject in instancestomove a mode behaviour for example:
instancesToMove[i].GetComponent<WaypointsBehaviour>().Loop
Now I know that all the instancesToMove will Loop The idea is to get easy access from the first script to the second enum modes.
Comment
Your answer
Follow this Question
Related Questions
I create material with script but it does not render right 0 Answers
Creating Splines from empties in script 0 Answers
How can i rotate all the child objects together at the same time ? 1 Answer
How can i give another name/number to the created Plane object name ? 0 Answers
How can i create List of maps from each Map class ? 0 Answers