Creating a button to move on to the next level?

cud_s05_extreme_tuning

#21

Really appreciate all the help you have given me today. I’ve taken your advice about the code and tried to implement that, but it still doesn’t seem to be working. I’m beginning to think that I might be putting the components in the wrong Game Objects?

I do have a level manager GameObject called “Level” and it houses my Level script and Scene Loader Script.

I have another GameObject under Canvas labeled “Next Level Button” and it houses my NextLevelButton script, and under that in the hierarchy is the actual button and text.

I did make the change to where it says GameObject.FindObjectOfType();

Sorry, this question has gone on to be more complicated than I had anticipated.


#22

You are more than welcome.

Could you perhaps zip up the project files and share them so that I can take a look. The forum will allow uploads of up to 10mb so if your zipped file is larger than that you will need to use a service like Google Drive or Dropbox and just post the URL.


#23

Okay, thank you. I’ve uploaded it to my drive and setting a link below:

https://drive.google.com/open?id=1g4UaEQVvx6nuI0tcoLYxmGMN1qUUZevx

I apologize if this seems a mess. This is literally my first Unity Project.


#24

Don’t put scripts on anything you plan to deactivate. Then the scripts won’t work.

An object can’t activate itself. Because its own scripts aren’t working. Deactivating an object does more than just make the object dissappear - it’s like it doesn’t exist, and neither does anything attached to it, or childed to it.


#25

IT WORKED! That’s what I’ve been doing wrong this entire time. I can’t believe that was the answer the entire time, driving me mad all day.

Thank you all so much for your help!


#26

Sorry for the delayed response, I had gone to bed when you shared the upload.

You can put scripts on objects which are going to be deactivated, but as Anthony states, it won’t be able to turn itself back on, which is why you would hold a reference to it in another object.

Glad you have got it working and thank you Anthony for stepping in during my slumber :slight_smile:


#27

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.