Question by
UnwantedOrphanX · Apr 21, 2017 at 04:08 PM ·
noob
no error message but script wont work
so i am making a endless runner and im following tutorial on youtube. But at a point he tries the script and it works good but for me it says " The associated script can not be loaded. Please fix any compile errors and assign a valid script." But the script i have is from what i can see is perfect to his. When i debug the script there is no error messages no warnings nothing. the only this that comes up is the application Output page and thats all mumbo jumbo to me. any ideas?
using System.Collections; using UnityEngine;
public class Platformgenerator : MonoBehaviour {
public GameObject thePlatform;
public Transform generationPoint;
public float DistanceBetween;
private float PlatformWidth;
public float DistanceBetweenMin;
public float DistanceBetweenMax;
public Objectpooler theObjectPool;
// Use this for initialization
void Start () {
PlatformWidth = thePlatform.GetComponent<BoxCollider2D> ().size.x;
}
//Update is called once per frame
void update () {
if (transform.position.x < generationPoint.position.x)
{
DistanceBetween = Random.Range (DistanceBetweenMin, DistanceBetweenMax);
transform.position = new Vector3 (transform.position.x + PlatformWidth + DistanceBetween, transform.position.y, transform.position.z);
//instantiate (theplatform, transform.position, transform.rotation);
GameObject newplatform = theObjectPool.GetPooledObject();
newplatform.transform.position = transform.position;
newplatform.transform.rotation = transform.rotation;
newplatform.SetActive (true);
}
}
}
Comment