Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania bez odpowiedzi
Viewing all articles
Browse latest Browse all 21942

Komunikacja pomiędzy skryptami w Unity

$
0
0

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.


Viewing all articles
Browse latest Browse all 21942

Trending Articles


TRX Antek AVT - 2310 ver 2,0


Автовишка HAULOTTE HA 16 SPX


POTANIACZ


Zrób Sam - rocznik 1985 [PDF] [PL]


Maxgear opinie


BMW E61 2.5d błąd 43E2 - klapa gasząca a DPF


Eveline ➤ Matowe pomadki Velvet Matt Lipstick 500, 506, 5007


Auta / Cars (2006) PLDUB.BRRip.480p.XviD.AC3-LTN / DUBBING PL


Peugeot 508 problem z elektroniką


AŚ Jelenia Góra