Hey everyone,
in the following script im trying to get a variable from within the same script but its inside a different function,
Im trying to access the variable url so i can save the string coming from SetTextures.
This DOES work if i make url static, and then later access it by saying LoadGalleryTexture.url = SetTextures.imagePath,
but when i have multiple objects that have this script attached, and it changes ALL their textures, when i need each one to be effected separately.
This is the script
using UnityEngine;
using System.Collections;
public class LoadGalleryTexture : MonoBehaviour {
//public string PicTexture;
public Transform TextObject;
public LoadGalleryTexture script;
public string url;
IEnumerator Start() {
WWW www = new WWW("file://" + url);
yield return www;
renderer.material.mainTexture = www.texture;
}
void Update()
{
TextObject.guiText.text = "texture is "+url;
script = GetComponent("LoadGalleryTexture") as LoadGalleryTexture;
if(SetTextures.PicHit.transform.position == transform.position)
{
script.url = SetTextures.imagePath;
}
}
}
any ideas???