Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by CamoLeopard · Aug 07, 2016 at 01:22 PM · c#scripting problemscene-loadingscene-switchingtransition

Custom 'wipe' Transition between scenes

I have been working on a minimalist style game recently, and after seeing some other games with cool transitions between scenes, I decided I would give it a go. I wanted a simple white bar to go across the screen from the center, maybe about 1/6 of the screen height, and then expand up and down to fill the screen. This animation would then reverse itself to reveal the next scene. My basic idea was to use a persistent canvas with an image object in it, and then lerp between values to give the effect of animation. This however decided it did not want to work, and I was wondering what people on here think is the best way to achieve what I mentioned above.

I am open to all suggestions, but preferably in C#.

Thanks alot!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CamoLeopard · Aug 08, 2016 at 03:11 AM 0
Share

Here is the code I used for lerping the scale of the image.

 transition += Time.deltaTime / 1.5f;
             float b  = transitionSpeed.Evaluate(transition);
             rtransform.localScale = Vector3.Lerp(intermediate, desiredScale, b);

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by nyonge · Aug 08, 2016 at 08:04 AM

In theory your basic idea is correct! Have one canvas object set to overlay, and use DontDestroyOnLoad to make it stick around through scene transitions. Give it a script like "TransitionManager" or w/e and give it a couple static variables that you can access from anywhere in your code.

 private static TransitionManager reference; //this is a reference
 
 void Awake() {
     reference = this; //do this so you can access your local reference (which holds the actual canvas object you move) from static classes
     DontDestroyOnLoad(gameObject); //so this doesn't get deleted between scenes
 }
 
 public static void ShowOverlay() {
     reference.ShowOverlayLocal();
 }
 public void ShowOverlayLocal() {
     //display your overlay here, lerp it onto the screen, whatever
 }
 
 public static void HideOverlay() {
     reference.HideOverlayLocal();
 }
 public void HideOverlayLocal() {
     //hide overlay here
 }

You might run into an issue where you get multiple of these in the same scene, if you go back into the scene where this spawns. In that case, in Awake() just use a tag to check if any of these already exist, and if so, delete the new one (leave the original one alone).

This is p much exactly what I do in my game to achieve the effect you're describing, so yeah, you were on the right track. Hope this helps!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Bolt Visual scripting and loading different scenes/levels 1 Answer

Transition between levels using 2d colider works once but not repeatidly. 1 Answer

Access loading screen scene components from Main Menu? 1 Answer

After loading scene raycast2D script doesn't detect all clicks 0 Answers

Multiple Cars not working 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges