#help with difficulty system
1 messages · Page 1 of 1 (latest)
tenemos el mismo error ahora mismo bro jajaja
chale
como le hago

y nunca respondió...
The error is saying it cant find it
yes but what can i do?
Make sure you spelled everything right. Make sure that component is on what you are trying to access
show the generador in inspector
se fue para siempre 😿
te deseo fuerza amigo
hey sry had an update
lemme look through this
Hey so heres my advice
Give this Generador a unique Tag, and use findObjectwithTag
store that into generador like you do already. Then call generador.GetComponent on the next line
private void Awake()
{
generador = GameObject.FindObjectWithTag("GeneradorLogicOrWhateveryouwanthere");
}
private void start()
{
generador.GetComponent<LogicaGenerador>();
}
lemme know if it doesnt work
so... i have to add
"private void Awake()
{
generador = GameObject.FindObjectWithTag("GeneradorLogic");
}"
?
yes. do that. then go into unity and give that same tag to your gameobject
then in the start method call the generador.GetComponent
then show me your new script
wait, do I have to replace this?
ahh
your using findobjectby tag and then splitting what you had into 2 sepearte lines
one in awake
and one in start
you store it into the variable generador in awake. Then you get that component in start once everything has started
Assets\Codigos\Dificultad.cs(13,21): error CS0029: Cannot implicitly convert type 'UnityEngine.GameObject[]' to 'LogicaGenerador'
yea instead of LogicaGenerador at the top make it GameObject
yupp change that LogicaGenerado to GameObject
You are searching for the GameObject
Then you search for the component
so that variable needs to be a GameObject
You are storing whatever GameObject it 'findsWithTag' back into generador.
so generador itself has to be a GameObject
make sense?
You can only put data into boxes of the same Type
GameObject generador;
Try to take the s off of Objects on line 14
FindGameObjectWithTag
also what did you name your tag
tag is different than the name
of the GameObject
GameObject.FindObjectWithTag("YourTagHere");
Did you give your gameobject a tag?
nop
gotta do that...