Witam. Mam problem z przekazywaniem jednej zmiennej do drugiego skryptu.(skrypty podpięte są pod jeden obiekt)
Skrypt 1:
public void PunktyRed(float zmiana)
{
zmiana2 = zmiana;
if (zmiana == 1) {
punkty++;
GetComponent<Score>().Punkty (punkty);
}
}
Skrypt 2:
using UnityEngine;
using System.Collections;
public class ZmianaKoloru : MonoBehaviour {
public float index = 1.0f;
public Material[] materials;
public Renderer rend;
public void Start(){
rend = GetComponent<Renderer> ();
rend.enabled = true;
}
public void Update()
{
}
public void Zmiana()
{
index += 1;
if(index == materials.Length + 1 )
{
index = 1;
//rend.material.SetColor ("_EmissionColor", Color.red);
}
print (index);
rend.sharedMaterial = materials [index - 1];
GetComponent<Ruch>().PunktyRed(index);
}
}
Problem:
W konsoli unity wyświetla się komunikat: "No overload for method 'PunktyRed' takes '0' arguments." Tylko nie rozumiem dlaczego skoro zmienną 'index' wysyłam do skryptu1 gdzie jej wartość przyjmuje zmienna 'zmiana' i dalej próbuje modyfikować, lecz dlaczego 'PunktyRed' nie pobierają argumentu nie mam pojęcia. Proszę o jakieś wskazówki.