Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
'público' no es válido para este artículo

Assets\GameControl2D.cs(25,10): error CS0106: el modificador 'público' no es válido para este elemento

Este error está ocurriendo ¿por qué? Por favor, que alguien me ayude a averiguarlo.

 using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameControl2D : MonoBehaviour { public static GameControl2D instance; public GameObject gameOverText; public bool gameOver = false; void Awake () { if (instance == null) { instance = this; } else if (instance != this) { Destroy (gameObject); } } void Update () { public void BirdDied() { GameOverText.SetActive (true); gameOver = true; } } }
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Tiene un método anidado/local BirdDied , que no puede tener modificadores de acceso. De todos modos, solo se puede acceder desde el cuerpo del método de Update . Así que esto compila:

 void Update () { void BirdDied() { GameOverText.SetActive (true); gameOver = true; } }

Pero como no lo usa en su código, dudo que sea lo que quiere.

over 4 years ago · Santiago Trujillo Report

0

using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bird2D : MonoBehaviour { public float upForce = 200f; private bool isDead = false; private Rigidbody2D rb2d; private Animator anim; // Start is called before the first frame update void Start() { rb2d = GetComponent<Rigidbody2D>(); anim = GetComponent<Animator>(); } // Update is called once per frame void Update() { if (isDead == false) { if (Input.GetMouseButtonDown(0)) { rb2d.velocity = Vector2.zero; rb2d.AddForce(new Vector2(0, upForce)); anim.SetTrigger("Flap"); } } } void OnCollisionEnter2D() { isDead = true; anim.SetTrigger("Die"); GameControl2D.Instance.BirdDied(); } }

Este es el archivo Bird2D.cs que ya eliminé público del método birdDied pero el error es el mismo

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!