Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development

Coding is not right

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement;

public class GameState : MonoBehaviour {

private bool gameStarted = false;
[SerializeField]
private Texture gameStateText;
[SerializeField]
private GameObject player;
[SerializeField]
private BirdMovement birdMovement;
[SerializeField]
private FollowCamera followCamera;
private float restatDelay = 3f;
private float restartTimer;
private PlayerMovement playerMovement;
private PlayerHealth playerHealth;

// Use this for initialization
void Start () {
    Cursor.visible = false; 

// playerMovement = player.GetComponent<PlayerMovement> (); playerHealth = player.GetComponent<PlayerHealth> ();

    //.. Prevent the plaer from moving at the start of the game
    playerMovement.enabled = false;

    // Prevent the bird from moving at start of the game
    birdMovement.enabled = false;

    //Prevent the follow camera from moving to its game position
    followCamera.enabled = false; }



    // Update is called once per frame
    void update () {

        // If the game is not styarted anmd press the space bar..
        if (gameStarted == false && Input.GetKeyUp (KeyCode.Space)) {

            //...Start the game
            StartGame();


            // ...Incremeate a Timer to count up to restarting...
            restartTimer = restartTimer + Time.deltaTime;

            //..and if it it reaches the restart delay

        if (restartTimer >= restatDelay) {

            //...then reload the currently loaded scene
            SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex);

            }


    }

}

    private void StartGame(){
    //Set Game state
    gameStarted = true;

    // Remove the start text
    gameStateText.color = Color.white;

    //Alow the player to Move
    playerMovement.enabled = true;

    //Alow bird to move
    birdMovement.enabled = true;

    // Allow the camera to move
    followCamera.enabled = true;

}

private void Endgame() {

    //Set the game State
    gameStarted = false;

    // Show the game over Text
    gameSateText.color = Color.white;
    gameStateText.Text = "Game Over!";

    // Remove the player from the game
    player.SetActive (false);

}

}

Unity game engine.texture does not see contain a defintion for color Assets/Scripts/GameState.cs(77,17): error CS1061: Type UnityEngine.Texture' does not contain a definition forcolor' and no extension method color' of typeUnityEngine.Texture' could be found. Are you missing an assembly reference?

found the answer