I’ve got an issue with my script and I tried many things, but nothing worked for me. Maybe you can help me find a solution for this: (Sorry the Problems are in german, hope it’s not a problem to help me)
Can you tell me what’s wrong here, because I don’t get it.
Here is my code if the screenshot is not enough:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameController : MonoBehaviour
{
public GameScene currentScene;
public BottomBarController bottomBar;
public BackgroundController backgroundController;
public ChooseController chooseController;
private State state = State.IDLE;
private enum State
{
IDLE, ANIMATE, CHOOSE
}
// Start is called before the first frame update
void Start()
{
if(currentScene is StoryScene)
{
StoryScene storyScene = currentScene as StoryScene;
bottomBar.PlayScene(storyScene);
backgroundController.SetImage(storyScene.background);
}
}
The complete error message contains everything you need to know to fix the error yourself.
You may wish to stop localizing your error messages, since there will be 100x or more useful information for the English language equivalent of error messages.
The important parts of the error message are:
the description of the error itself (google this; you are NEVER the first one!)
the file it occurred in (critical!)
the line number and character position (the two numbers in parentheses)
also possibly useful is the stack trace (all the lines of text in the lower console window)
Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.
All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.
Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.
Well, as a german myself I wouldn’t have any trouble reading the error, but the screenshot has a poor quality you can barely read anything^^. Though the errors is telling you that it’s not possible to convert a StoryScene into a GameScene or vice versa. That’s most likely because they are two types which do not derived from each other.
We don’t know what those two types are, so we can’t really help you here. Though you clearly have a fundamental logical issue here. If the compiler spits out warnings it is guessing you may doing something wrong. If it spits out errors, it knows you’re doing something wrong
If you need further help with this, you should tell us / show us what those two types actually are. In short the compiler just tells you that you have apples and oranges and you try to turn one into the other which doesn’t work.