#Thread

1 messages Ā· Page 1 of 1 (latest)

rugged trellis
#

do you have any compile errors?

tall rampart
#

I don’t think so

rugged trellis
#

look in the Console.

#

then you will know for sure

#

i see the error, but let's check that first

tall rampart
#

Where is the console window

rugged trellis
#

you'll get very familiar with it (:

tall rampart
#

Ok found it! It said that de main object main camera is missing and the reference script on the behaviour is missing

rugged trellis
#

that's a separate issue, I suspect

#

also, is there a reason you're using unity 2017..?

tall rampart
#

Yes cause my computer is old and I am still saving up to buy a good one

rugged trellis
#

i see

#

do the errors persist after hitting Clear in the console window?

tall rampart
#

Yes

rugged trellis
#

Show me the errors.

tall rampart
#

Nevermind they appeared again

#

Ill remove the game object from the camera

rugged trellis
#

did you attach a "Scene Changer" to that object, then rename the class to "Scene Switcher"?

#

because that would certainly cause the problem

tall rampart
#

Ok

rugged trellis
#

the name of the script file must match the name of the class

#

hence this.

tall rampart
#

Ok I changed it to SceneSwicher

#

Nothing changed

rugged trellis
#

do the names match?

#

if so, you should be able to add the SceneSwitcher component.

tall rampart
#

Ok where could I find it?

rugged trellis
#

do you not know where the Add Component button is?

tall rampart
#

Thought I had to add it into here

rugged trellis
#

no, that is not where you add a component

#

that is where you choose which component to target.

#
  • add the SceneSwitcher to a game object
  • drag that game object into the "on click" field
  • choose the function from the dropdown
tall rampart
#

Ok but it’s still giving me the same error that it can’t add the script to the game object

rugged trellis
#

Then you either still have a compile error (an error that doesn't go away when you clear the console)

#

or you didn't name the class correctly

tall rampart
#

Ok

#

Behaviour of main camera is missing I am going to try and fix it I guess

rugged trellis
#

that's not a compile error

#

it's a problem, sure

#

it suggests that you have a missing component on the "Main Camera" object

#

if you look at the inspector after selecting it, do any components say "Missing"?

tall rampart
#

The render texture

rugged trellis
#

Show me what it looks like.

tall rampart
rugged trellis
#

That is not a problem.

#

"None" just means nothing is assigned

#

you only assign something there if you want to make the camera render to a texture, instead of the screen

#

i'm curious about that "Nothing Selected" component

#

ah, that's what Unity used to say instead of 'Missing'

#

lol

tall rampart
#

Bruhh

rugged trellis
#

i briefly used unity about 8 years ago

#

but i don't remember a lot of the specifics, haha

tall rampart
#

XD

#

When I tap it the only option I get is ā€œNoneā€

rugged trellis
#

just remove it

#

i think you want the little cog icon

tall rampart
#

Ok?? 🄲

rugged trellis
#

again, the RenderTexture thing is completely irrelevant

#

ignore it

#

i am talking about this component

#

that says "Nothing Selected"

#

the target texture has nothing to do with this

tall rampart
#

But it said that the script has errors

#

Nvm maybe I should wait until I have a better computer cause this version isn’t working the way I was hoping it to

rugged trellis
#

show or describe to be me exactly what it said

tall rampart
rugged trellis
#

you spelled the file name as "SceneSwicher"

#

is that exactly how you spelled the name of the class?

tall rampart
#

Where is the class šŸ˜…

rugged trellis
#

you showed me a picture of it earlier

#

you declared a class class called SceneSwitcher

tall rampart
#

Ok

rugged trellis
#

that name must EXACTLY match the name of the file

#

or it will never work

tall rampart
#

Omg it’s spelled wrong

#

Ok fixed it

#

It stopped giving the error

rugged trellis
#

also, an important tip: if you rename a file, rename it in unity

#

that way, it understands that the new file is the same thing as the old file

#

otherwise, all of the components made from that script will break

tall rampart
#

Ok I will

rugged trellis
#

now that the component is attached and working, drag the object it's on into the field on the button

#

and pick the function you want

tall rampart
#

Ok

#

It’s not switching scenes but I’ll get to that later

#

Thanks!

#

It’s still not showing up to the on click()

rugged trellis
#

double click on the object here. does it take you to the object that you put the Scene Switcher component on?

tall rampart
#

It connects to the game object that I added the script to

rugged trellis
#

show me the inspector for that target object

tall rampart
rugged trellis
#

that is not the inspector

#

that is an object picker

#

i'm asking you to select the object you dragged into that field

tall rampart
tall rampart
rugged trellis
#

okay, so that looks reasonable

#

name the object something more distinctive

#

like "Switcher"

tall rampart
#

Ok just did

rugged trellis
#

so, the button's target is now called "Switcher"?

tall rampart
#

Yes

rugged trellis
#

do you see an entry in the function dropdown called "SceneSwitcher"?

tall rampart
#

Yes

#

I set it so it would switch to the main scene but it still doesn’t

rugged trellis
#

so you can select the function?

tall rampart
#

Yes

rugged trellis
tall rampart
#

That’s what I meant yea

rugged trellis
#

you had nothing selected here

tall rampart
#

I changed it cause it finally showed up

rugged trellis
#

ah, okay

#

now, are you getting anything in the console when you click the button?

tall rampart
#

Nothing happens when I click the button exept that it shows it’s button

rugged trellis
#

so nothing appears in the console at all?

#

exept that it shows it’s button

what do you mean?

tall rampart
#

I can click the button but nothing happens like it doesn't switch to another scene

rugged trellis
#

And nothing appears in the console?

#

you're looking at it right now?

tall rampart
rugged trellis
#

okay, so there is an error in there

#

what does it say?

tall rampart
#

Omg it worksss

#

It actually switched to the next scene

#

:DD

#

Thanksss!!!

rugged trellis
#

Did you add it to the list in the Build Settings menu?

tall rampart
#

Yes I did

rugged trellis
#

That'll fix it

#

you're welcome (: