Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411512 Posts in 69376 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 10:19:05 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)New game: Alphastack
Pages: [1]
Print
Author Topic: New game: Alphastack  (Read 3878 times)
bet_der
TIGBaby
*


View Profile
« on: May 16, 2023, 02:04:45 PM »

So I started making a game yesterday, but not really. I didn't even finish the title screen because I made the separate scene for the game but the script tutorial from 3 years ago didn't work. It's a C# script. Visual studio says that there is something wrong with it and the SceneManager in the script won't turn green-blue. I can't drag the script into the canvas like in the video. This is the code:
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement

public class NewBehaviourScript : MonoBehaviour
{

   public void PlayButton()
    {
        void SceneManager.LoadScene("game")
    }
}
But now, I should probably explain what this game is. It will be like Tetris, but with words. Random words will fall and occasionally a > or < will fall. The > and the < will make the letter it falls on move in their respective directions. Any letters in the way when the letters move will also move.
Can you fix my bad code? Maybe I just forgot a semicolon that I didn't notice in the tutorial or SceneManager is something else now.
Edit: I forgot to mention I am using Unity.
Logged
Thaumaturge
Level 10
*****



View Profile WWW
« Reply #1 on: May 22, 2023, 01:22:30 AM »

It's been a long time since I used Unity and C#, so I may be entirely off, but I do notice one thing:

In your "using" declarations, all but the last end in a semi-colon. What happens if you change that?

Otherwise, does Visual Studio give a specific error? If so, then that error might help in determining where the problem lies.
Logged

Gare Games
Level 0
*



View Profile WWW
« Reply #2 on: November 03, 2023, 05:44:12 AM »

So I started making a game yesterday, but not really. I didn't even finish the title screen because I made the separate scene for the game but the script tutorial from 3 years ago didn't work. It's a C# script. Visual studio says that there is something wrong with it and the SceneManager in the script won't turn green-blue. I can't drag the script into the canvas like in the video. This is the code:
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement

public class NewBehaviourScript : MonoBehaviour
{

   public void PlayButton()
    {
        void SceneManager.LoadScene("game")
    }
}
But now, I should probably explain what this game is. It will be like Tetris, but with words. Random words will fall and occasionally a > or < will fall. The > and the < will make the letter it falls on move in their respective directions. Any letters in the way when the letters move will also move.
Can you fix my bad code? Maybe I just forgot a semicolon that I didn't notice in the tutorial or SceneManager is something else now.
Edit: I forgot to mention I am using Unity.



Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement

public class NewBehaviourScript : MonoBehaviour
{

   public void PlayButton()
    {
        SceneManager.LoadScene("game")
    }
}

You put a void in front of SceneManager.LoadScene("game"). That will cause an issue.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic