Search Unity

[RELEASED] Pro Camera 2D - The definitive 2D & 2.5D Unity camera plugin

Discussion in 'Assets and Asset Store' started by luispedrofonseca, Jul 29, 2015.

  1. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
  2. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I'm using a Boundaries Trigger to change my Numeric Boundaries when the player hits a certain trigger. It works very well, but what if I wanted to do this, not by hitting a trigger but by some event? For example, a mini boss is defeated and now the boundaries need to be changed when that mini boss dies, not when the player touches a trigger?
     
  3. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    Ok thought of a good way to do this. I make another Boundaries Trigger and make the trigger area cover the entire area the player could be in at that time. And have it disabled. Then when the mini boss is defeated, I enable the Boundaries Trigger game object and it gets triggered right away.
     
  4. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    @brittany The numeric boundaries are just regular C# properties. You can tween them however you'd like (through code or even Unity animations) and it should work.
     
    brittany likes this.
  5. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    Thank you, Luis!
     
  6. hoyoyo80

    hoyoyo80

    Joined:
    Jan 31, 2018
    Posts:
    58
    Thank bro. I remove one of procamera feature(but dont remember which one|)and now i can use FOV as u said. And now i had one more problem with TransititionFX, that it wont fade in the scene and remain black upon staring the player.

    EDIT: nevermind,i need to call the transition..thats it.TQ
     
    Last edited: Feb 21, 2022
  7. ww3370jm

    ww3370jm

    Joined:
    Feb 9, 2014
    Posts:
    1
    I just wanted to say how great your Pixel Perfect extension is. I started off using Unity's Pixel Perfect Camera and struggled to get the results I wanted. Especially, their Stretch Fill gives blurry results. I think I tested every possible combination I could think of.

    I remembered that ProCamera2D had a Pixel Perfect solution as well and decided to try it. Using that along with the Content Fitter (for Letter/Pillarboxing to maintain my aspect ratio) I had it set up and working in a few minutes with perfect results. Notably, scaling to non integer values (such as going from 480x270 to 720p) looks very sharp and crisp and not blurry as it does with other solutions.

    Thank you!
     
    luispedrofonseca likes this.
  8. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I like the Shake extension but I am having an issue where sometimes after a shake has completed, the ProCamera2DShakeContainer will not be back to 0,0,0, it may be off in the x and y positions by 0.1 or 0.2, making things look off a bit.
     
  9. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I'm still wondering about this. Shouldn't the shake reset the shake container back to 0,0,0 after the shaking is over?
     
  10. samlletas

    samlletas

    Joined:
    Jan 2, 2016
    Posts:
    30
    Hi @luispedrofonseca , I saw this discussion from some time ago about the possibility of including assembly definitions in Pro Camera and was wondering if are there still plans to adopt them.

    A way to avoid having to restructure Pro Camera code folders could be to use assembly definition references inside each of the Editor folders (that way there would not be need to merge all of them into one folder), for example:

    Code (CSharp):
    1.  
    2. ├───ProCamera2D/
    3.     ├───ProCamera2D.asmdef
    4.     ├─── ...
    5.     ├───3rd Party Plugins Support/
    6.     │   ├───PlayMakerActions/
    7.     │   │   ├───ProCamera2D.Plugins.PlayMakerActions.asmdef
    8.     │   │   └─── ...
    9.     │   └─── ...
    10.     ├───Code/
    11.     │   ├───Core/
    12.     │   │   ├───Editor/
    13.     │   │   │   ├───ProCamera2D.Editor.asmdef   <----- Editor Assembly
    14.     │   │   │   └─── ...
    15.     │   │   └─── ...
    16.     │   ├───Extensions/
    17.     │   │   ├───Editor/
    18.     │   │   │   ├───ProCamera2D.Editor.asmref   <----- Reference
    19.     │   │   │   └─── ...
    20.     │   │   └─── ...
    21.     │   ├───Helpers/
    22.     │   │   ├───Pixel Perfect/
    23.     │   │   │   └───Editor/
    24.     │   │   │   │   ├───ProCamera2D.Editor.asmref   <----- Reference
    25.     │   │   │   │   └─── ...
    26.     │   │   │   └─── ...
    27.     │   │   └─── ...
    28.     │   ├───Triggers/
    29.     │   │   ├───Editor/
    30.     │   │   │   ├───ProCamera2D.Editor.asmref   <----- Reference
    31.     │   │   │   └─── ...
    32.     │   │   └─── ...
    33.     └───Examples/
    34.         ├───ProCamera2D.Examples.asmdef
    35.  
    The downside is that I only see assembly definition references mentioned in the documentation from Unity 2019.4 upwards so they are probably not supported in 2018.4 which Pro Camera states as the minimum supported Unity version.

    Another workaround I've seen some assets from the store do is to place a single assembly definition inside the asset root folder and then wrap every Editor script inside the conditional:

    Code (CSharp):
    1.  
    2. #if UNITY_EDITOR
    3.      //Code here for Editor only.
    4. #endif
    5.  
     
    Last edited: May 13, 2022
  11. luigi7

    luigi7

    Joined:
    Jun 30, 2015
    Posts:
    99
    Hello @luispedrofonseca, I have this issue with parallax and URP:
    when I try to add parallax camera I get these errors,

    and

    as result, I see that the Parallax Layers Cameras are added BUT the culling mask dropdown does not let changing from nothing value.
     
  12. NightcoreDragunDev

    NightcoreDragunDev

    Joined:
    Sep 13, 2021
    Posts:
    2
    Hello, the ProCamera2D FX Transition isnt working with the new 2D URP?
     
    nodoxi likes this.
  13. nodoxi

    nodoxi

    Joined:
    Feb 27, 2013
    Posts:
    9
    Is there a chance to get TransitionFX for URP?
     
  14. seimusinho

    seimusinho

    Joined:
    Apr 2, 2019
    Posts:
    3
    Hello @luispedrofonseca,

    with parallax and URP active I get a black background as it doesn't render the parallax cameras. Any solution?
     
  15. agelvik

    agelvik

    Joined:
    Nov 6, 2015
    Posts:
    23
    found a bug where the camera component Render Type get changed from Base to Overlay after exiting the camera target selection window. i also can't drag and drop gameobjects into the cam target input parameter, so i gotta open the window and search for my camera target instead.
     

    Attached Files:

  16. LunaTrap

    LunaTrap

    Joined:
    Apr 10, 2015
    Posts:
    120
    Hello, I have a problem where the Zoom to Fit Script does not work properly with boundaries, I tried changing to Zoom with FOV to not physically move the camera but still does not work, any idea what is happening?
     
  17. LunaTrap

    LunaTrap

    Joined:
    Apr 10, 2015
    Posts:
    120
    Most importantly I want to know how can I get the world position of the edges of the camera viewport? I need it to have my game be 2 players contra-style game where the players cant physically leave the screen, Can you help me with this, please? I want to clamp the player's positions within the camera view and make it impossible to leave it. I just need the world positions of the edges. How do I get them?
     
  18. OnyxGuts

    OnyxGuts

    Joined:
    Jul 22, 2022
    Posts:
    1
    @luispedrofonseca I really need some help here. I have figured almost everything out on my own so far. But when I add a prefab target to the camera it really seems to want to only follow where the original enemy was before I deleted it from the scene after making it a prefab. And then doesn't want to follow the instantiated prefabs with the zoom settings. This is my code for random spawning with the add camera target.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Com.LuisPedroFonseca.ProCamera2D;
    5.  
    6. public class SpawnManager : MonoBehaviour
    7. {
    8.     public GameObject[] enemyPrefabs;
    9.     private float spawnRangeX = 11;
    10.     private float spawnRangeY = 3;
    11.     private float startDelay = 10;
    12.     private float spawnInterval = 10;
    13.     public
    14.  
    15.     void Start()
    16.     {
    17.         InvokeRepeating("SpawnRandomEnemy", startDelay, spawnInterval);
    18.     }
    19.  
    20.     // Update is called once per frame
    21.     void Update()
    22. {
    23.    
    24. }
    25.     void SpawnRandomEnemy()
    26.     {
    27.         int enemyIndex = Random.Range(0, enemyPrefabs.Length);
    28.         Vector3 spawnPos = new Vector3(Random.Range(-spawnRangeX, spawnRangeX), Random.Range(-spawnRangeY, spawnRangeY), 0);
    29.  
    30.         Instantiate(enemyPrefabs[enemyIndex], spawnPos, enemyPrefabs[enemyIndex].transform.rotation);
    31.         ProCamera2D.Instance.AddCameraTarget(enemyPrefabs[enemyIndex].transform, 1f, 1f, 0f);
    32.     }
    33. }
     
  19. tomraegan

    tomraegan

    Joined:
    Mar 28, 2016
    Posts:
    137
    Hi there,

    What would be the performance impact of having ~300 rooms included on the Rooms extension on the camera component?

    Is there an alternative to having them all listed on the camera component? A separate file perhaps?

    Thanks kindly!
     
  20. tomraegan

    tomraegan

    Joined:
    Mar 28, 2016
    Posts:
    137
    Just to answer my own question, to quote the dev (from another thread):
    You can have multiple Rooms extensions (each on its own GameObject) and you can then activate them manually.
     
    luispedrofonseca likes this.
  21. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    Sorry everyone, once again the forum notifications have failed me... No idea why this happens. Sorry for the very late replies! :(

    Thank you, glad it works well for you!

    It should. Can you reproduce this issue with the included shake demo scene?

    The GeometryBoundaries are a bit finicky because they rely on raycasts and depending on the boundaries geometry it might end up getting stuck. I recommend trying to adjust the geometry or simply use NumericBoundaries which don't have these issues.

    Your script looks correct. You're probably doing some other thing that's preventing the camera from moving.
     
  22. LunaTrap

    LunaTrap

    Joined:
    Apr 10, 2015
    Posts:
    120
    Thanks a lot, I will!
     
    luispedrofonseca likes this.
  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Deleted a post with copyrighted content that could not be shared (a plugin). Please could developers be mindful of things like that, thank you!
     
  24. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    Just a heads-up that I messed up on the latest update on which I introduced the much requested assembly definitions. It was brought to my attention that it was throwing errors on build and I apologize for not having tested it beforehand.
    It is now fixed and it should be up on the Asset Store in the next few minutes. Cheers!
     
  25. ptm_oo

    ptm_oo

    Joined:
    Oct 30, 2014
    Posts:
    35
    Hey. Can ProCamera handle X/Y shift of perspective physical Camera? (Im asking before buying) Thanks
     
  26. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    I'm not sure what you mean. Can you please explain further?
    ProCamera2D supports XY axis as well as perspective cameras, but not sure if that's what you're looking for.
     
  27. ptm_oo

    ptm_oo

    Joined:
    Oct 30, 2014
    Posts:
    35
    Yes, there is shift option in camera, I was wondering if ProCamera 2d/2.5d takes it under concideration.

    image:
    ice_screenshot_20230218-180055.png
     
    Last edited: Feb 22, 2023
  28. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    That's a very good question. I'm not very familiar with the physical camera option but I believe it should work due to the method I'm using to calculate the boundaries.
     
  29. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    I have a minor issue with the parallax script in Unity 2022.2.11 with ProCamera2D version 2.9.5. It does simply not work after recompiling any scipt in the project and running the project in the editor directly thereafter. I am also disabled the Unity options "Reload domain" and "Reload scene" in the projects settings. Ending the play mode and re-entering the play mode again, the parallax script works fine. This issue can be can be even reproduced wiht the sample Platformer Parallax scene provided with the ProCamera2D package.

    I already tried resetting the ProCamera2D component and its extensions, also toggling the parallax at the start of my scene but with no success. Is there any solution for this or can a fix be provided?
     
  30. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    @FaithlessOne Not sure I understood your issue. Can you please explain further?
     
  31. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    I made a short video to demonstrate:

    https://streamable.com/3a1dpc?loop=0

    (NOTE: Video is only 24 hours after last edit of this post available.)

    You can see the second time the editor enters the playmode the parallax effect does not work. All background graphics are moving together at same speed. It only behaves this way after Unity compiles some scripts in the project.
     
    Last edited: Mar 28, 2023
  32. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    Could the video show the issue or is it still unclear?
     
  33. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @FaithlessOne Does your console log look any different when it's working vs when it's not?
     
  34. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    No. I checked the console log but there is no message from ProCamera2D or any unknown source. Looks all normal to me in both cases (Parallax working and not working).
     
  35. chaosmonger

    chaosmonger

    Joined:
    Jan 23, 2019
    Posts:
    71
    Hello, I wonder if it's possible to have a pure Pixel Perfect camera, similar to CineMachine one. Let me explain better: I know Pro Camera 2D has a Pixel Perfect script, but will that work like Unity Pixel Perfect Camera? I'm working on a game with a resolution 426x240 and I want this resolution to scale properly on 1920x1080 for instance, but also avoiding smaller pixels than that, as if the 1920x1080 was simply a scaled 426x240, without affecting - for instance - particles (i.e. with the Unity Pixel Perfect Camera I can have pixelated particles with settings like "Upscale Render Texture" to true, and Crop Frame). Is that achievable within Pro Camera 2D? And if so, with which settings?
     
  36. wedgiebee

    wedgiebee

    Joined:
    Aug 9, 2016
    Posts:
    40
    Hi there,

    I'm using FixedUpdate as my ProCamera2D's UpdateType since I have all my game logic and am moving all my objects in FixedUpdate. I'm using the Rooms component, which is awesome, and I want to set TimeScale to 0 during transitions between rooms, and then reset TimeScale to 1 when the transition is complete. However, as soon as I set TimeScale to 0, the room transition doesn't actually happen.

    EDIT: ^ I have IgnoreTimeScale set to true and this still happens

    I tried it switching my UpdateType to LateUpdate, and it works fine. (But, because I'm using FixedUpdate for everything else, I get camera jitters.)

    How I do I make it so this works using FixedUpdate for ProCamera2D's UpdateType?

    Thank you!
     
    Last edited: Apr 30, 2023
  37. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    Have you tried using the ignore timescale option?
    upload_2023-4-30_13-10-35.png
     
    wedgiebee likes this.
  38. wedgiebee

    wedgiebee

    Joined:
    Aug 9, 2016
    Posts:
    40
    Oops, thanks for the reminder, that's a big thing to forget to mention in my post! I am already using Ignore TimeScale, but it's still not working with my room transitions.
     
  39. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    Were you able to solve this issue? It sounds like a really odd one. Does it happen on a new empty project with just ProCamera2D?
     
  40. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    Pro Camera 2D's pixel-perfect extension simply rounds everything into a "pixel grid". It doesn't work with RenderTextures and it won't alter the look of anything that's not rounded. Hope this answer your question!
     
  41. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    Can you please send me a sample project (through PM or email) that reproduces this issue so I can have a look?
     
    wedgiebee likes this.
  42. wedgiebee

    wedgiebee

    Joined:
    Aug 9, 2016
    Posts:
    40
    Sure thing! Sample project sent through ProCamera website's email form!
     
    luispedrofonseca likes this.
  43. OmarOfMA

    OmarOfMA

    Joined:
    Sep 6, 2022
    Posts:
    13
    I wanted to use GeometryBoundaries because I can control and visualize them using colliders without needing a ProCamera2D camera present. This is required when the boundaries are specified in the prefab of each level.

    But GeometryBoundaries is buggy. So I ended up writing a script that takes my colliders and sets up NumericBoundaries based on the colliders. This is working pretty well so far.
     
    luispedrofonseca likes this.
  44. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    Thanks for letting me know. That's a very cool idea that I'll try to integrate in the upcoming 3.0 release.
     
    OmarOfMA likes this.
  45. demimonde

    demimonde

    Joined:
    May 3, 2021
    Posts:
    27
    Is there a good/official way to "pause" all current cam influences and targets, so that I can move the camera manually, as part of a timeline or with my own scripts, and then "resume" everything again smoothly, so the camera smoothly moves back to its intended targets and active influences? (I don't care about zooms, as I use my own zoom system anyway). I'm aware of the cinematics extension, but that's not something I can use.
     
  46. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    You can disable the ProCamera2D component and it should work as expected.
     
  47. sidmakesgames

    sidmakesgames

    Joined:
    Sep 19, 2013
    Posts:
    7
    I'm using Unity 2022.3.0f1 LTS version and latest version of ProCamera2D (2.9.5).

    Every time I uncollapse the ProCamera2D main component in the inspector window, it completely throttles my system which makes the tool completely unusable. Everything starts to function properly when I collapse the ProCamera2D component.

    Does anyone happen to know what the issue is and how can I resolve it?
     
  48. BACALL

    BACALL

    Joined:
    Feb 21, 2017
    Posts:
    87
    Sorry I can't help but I'm experiencing it too on a MacBook Pro with M1 Max, not sure why. What system are you on?
     
  49. sidmakesgames

    sidmakesgames

    Joined:
    Sep 19, 2013
    Posts:
    7
    Oh! That's a bummer man. And I'm not able to figure out what is causing it either. I'm on Macbook Air M1 although I tried to run the project on Windows too and facing the same issue.

    Although when I create a new project in the same version of Unity, in an empty scene, same version of ProCamera2D doesn't give any problem. Not sure what's happening here.
     
  50. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    try profiling the editor - that should help track down what’s causing it