Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[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. luigi7

    luigi7

    Joined:
    Jun 30, 2015
    Posts:
    57
    Hello, I'a experimenting Zoom and DollyZoom methods from code and I need to do things when zoom finishes:
    is any event available like a onZoomFinished?
    EDIT there is a way to combine Zoom and TransitionsFX? Any events here?
    Thanks
     
  2. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @luigi-freguglia There are now! Just added two new events to the Core class -
    "OnUpdateScreenSizeFinished" and "OnDollyZoomFinished". Calling the DollyZoom method will fire both while just updating the screen size (through a zoom or other method) will only fire the first.

    I don't understand what you mean with combining Zoom and TransitionsFX. Can you please explain further?

    P.S.: If you want access to the new version and not wait for release, get in touch directly and send me your invoice.
     
    luigi7 likes this.
  3. poliman

    poliman

    Joined:
    Feb 5, 2015
    Posts:
    16
    Ok now I've tested latest release, and:

    problem 1 is solved
    1. When all cameras with ProCamera2D script are active from start, one of them is assigned with 3 targets PC2DPanTarget, and it is unable to pan

    but problem 2 still exists
    2. When all cameras are active, when you move first pan it affects rest of cameras targets, and have to MoveCameraInstantlyToPosition to default position everytime I switch camera.

    so how to seperate each camera so it input only pans this sepcific one not all targets
     
  4. luigi7

    luigi7

    Joined:
    Jun 30, 2015
    Posts:
    57
    No problem, I'll wait for the udpdate from the store :)
    About the second question: I'd like to do a zoom out/in and, at the same time, some kind of smooth and fast transition to black (or something else).
    It's not vital for the design, but it may fit so I'd just like to try.
     
  5. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
  6. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @luigi-freguglia To do that simply call both methods at the same time - the zoom method on the Core class and the transition from the TransitionsFX extension.
     
  7. luigi7

    luigi7

    Joined:
    Jun 30, 2015
    Posts:
    57
    At the moment i'm up to 2.51, is it going to be a .52?
     
  8. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
  9. Nikolasio

    Nikolasio

    Joined:
    Dec 6, 2014
    Posts:
    56
    The content fitter is superb!! Thank you for this!!
     
    luispedrofonseca likes this.
  10. poliman

    poliman

    Joined:
    Feb 5, 2015
    Posts:
    16
    I think you dont have the same setup as I do.
    How to show you what i mean, movie? send you example project?
     
  11. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @poliman Yes, that would be the best. Please send me a sample project through PM.
     
  12. luigi7

    luigi7

    Joined:
    Jun 30, 2015
    Posts:
    57
    @luispedrofonseca Sorry to ask again, I need to plan the camera job and I am waiting for the .52. When is it planned? Approximately, just llike before Christmast, befor Halloween... :)
     
  13. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @luigi-freguglia I don't have a release date, but certainly before Christmas! Probably early next week, but can't promise.
    But, like I told you before, simply send me your invoice through email or PM and I'll send you the version.
     
    luigi7 likes this.
  14. Cypras

    Cypras

    Joined:
    Oct 25, 2013
    Posts:
    56
    How can you adjust the x/y parameters during runtime for Camera Window?
     
  15. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @Cypras You can change the extensions' properties/values like any other C# class. Simply get a reference to it and then you can do something like:
    Code (csharp):
    1. myCameraWindow.Width = 10f;
     
  16. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    Is it possible to have multiple sets of rails in one level? I'd like to have a free flowing camera (e.g Camera Window) generally, but sometimes snap to rails that are placed throughout the level. As far as I can see, I can only create one set of rails.
     
  17. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    Hey @Andrew122222, at the moment that is not supported. However, if you have some coding knowledge it should be pretty straightforward to build a custom extension, very similar to the current Rails extension, that does it.
    Any how, that feature was already on my to-do list but I'll move it up on the priority. Can't promise you a release date though.
     
    Zehru likes this.
  18. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    Thanks for the fast reply.

    I'll start looking into doing my own custom rails if I get time then. I have already done a custom camera system and custom trigger since your code is nicely organised and easy to add to. Cheers.
     
    luispedrofonseca likes this.
  19. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    306
    Hello @luispedrofonseca

    I had to update to Unity 2017 so i updated Playmaker and PC2D too. I see that Playmaker actions changed their name. For example:

    MissingAction: Could Not Create Action: ProCamera2DShakeWithPresetAction (Maybe the script was removed?) is now PC2DShakeWithPreset. Any way of sorting this out so i don't have to refactor a lot of FSM's?
     
  20. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @Kruko I'm very sorry for the inconvenience but I ended up having to do that change because of the transition to the PlayMaker ecosystem (long story). As a workaround, in case you don't want to do that refactor, my recommendation is to duplicate the actions folder and rename them to match their previous names.
     
    Oshigawa likes this.
  21. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    306
    No problem, thanks :)
     
    luispedrofonseca likes this.
  22. ZygoUgo

    ZygoUgo

    Joined:
    Jul 11, 2017
    Posts:
    59
    Hi, great work by the way :) I was hoping there is a way to get the parallax feature to lock to my game's platforms layer so that it only scrolled horizontally but not up and down. My character jumps quite high and the parallax all comes apart on the verticle axis, it is working as intended but not quite how I need it. I have treid locking the x axis but this still comes apart when my character jumps or climbs up high, am I doing something wrong or is this not a feature of your work? Thanks for any help :)
     
  23. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    Hi @ZygoUgo, you can disable the Parallax on the Y axis and that will stop the vertical movement of the parallax layers. If you also want to stop the vertical movement of the camera simply disable "Follow Y" option on the core component.
     
  24. ZygoUgo

    ZygoUgo

    Joined:
    Jul 11, 2017
    Posts:
    59
    Thanks Luis :) I have done that but it still isn't quite what I'm after, will I be able to script some behaviour in to the camera to get the parallax to stick to the same level as the platforms? (default 0 layer)
     
  25. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @ZygoUgo Not sure what you're trying to accomplish, but yes, it's totally possible to adjust the parallax system to fit your needs. If needed, you can even create your own extension (based on the Parallax one).
     
    ZygoUgo likes this.
  26. luigi7

    luigi7

    Joined:
    Jun 30, 2015
    Posts:
    57
    I see it's been released, thank you :)
    How do I use them? Its enough something like that?
    Code (CSharp):
    1. void OnDollyZoomFinished() {
    2. //my things
    3. }
     
  27. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @luigi-freguglia You have to add a listener to the event first.
    Code (csharp):
    1.  
    2. void Start()
    3. {
    4.    ProCamera2D.Instance.OnDollyZoomFinished += OnDollyZoomFinished;
    5. }
    6.  
     
    luigi7 likes this.
  28. luigi7

    luigi7

    Joined:
    Jun 30, 2015
    Posts:
    57
    What is the function of the float parameter that OnDollyZoomFinished asks?
     
  29. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    The "OnDollyZoomFinished" event returns a float that has the new FOV that was passed to the DollyZoom function. Your event handler should be:

    Code (csharp):
    1. void OnDollyZoomFinished(float newFOV)
    2. {
    3.    // your code...
    4. }
     
  30. Nikaas

    Nikaas

    Joined:
    May 30, 2013
    Posts:
    92
    Hi,

    For some time I'm getting a warning from the PixelPerfectSprite component (the one attached to the sprites). The problem probably comes from the multi-scene setup - the GO hierarchies that gets the error are in a different scene than the camera. There is no "real" problem because these GOs are disabled and used only kinda like prefabs, but it is still annoying to get many warnings on Play/Stop for each of them. Is there some way to avoid those warnings?

    Next is the warning:
    ProCamera2DPixelPerfectSprite: ProCamera2D not found! Please add the ProCamera2D.cs component to your main camera.
    UnityEngine.Debug:LogWarning(Object, Object)
    Com.LuisPedroFonseca.ProCamera2D.BasePC2D:get_ProCamera2D() (at Assets/Plugins/ProCamera2D/Code/Core/BasePC2D.cs:21)
    Com.LuisPedroFonseca.ProCamera2D.ProCamera2DPixelPerfectSprite:OnDestroy() (at Assets/Plugins/ProCamera2D/Code/Helpers/Pixel Perfect/ProCamera2DPixelPerfectSprite.cs:180)
     
  31. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @Nikaas Yeah, that happens because the script "thinks" there's no ProCamera2D set up (and there isn't on that scene). Any how, I'll try to add a workaround for that on the next update.
     
    Nikaas likes this.
  32. Solid_Metal

    Solid_Metal

    Joined:
    Mar 25, 2015
    Posts:
    45
    is there any way to make the camera following the object rotation on 1 axis with this plugin?, so far reading the documentation seems theres no other direct way to do it
     
  33. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @Solid_Metal No, rotation outside of the supported axis (XY, XZ and YZ) is not officially supported. Although the majority of the extensions would still work, you'll probably get some weird behaviour.
    I'm planning to introduce support for this at a later stage.
     
  34. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,157
    Hey there.

    Which settings do I have to make if I want to shake the ProCamera infinitely? I'm on 1.9 if this is important.

    I noticed that I do something like this:

    Code (CSharp):
    1. m_proCameraShake = GlobalReferenceHolder.GlobalMainCamera.GetComponent<ProCamera2DShake>();
    2.  
    3.             m_proCameraShake.Shake(m_shakeDuration, m_shakeStrength, m_shakeVib, m_shakeRand);
    And set the shakeVib (the vibrato parameter) to something like 999999 I will get around 200 MB of Garbage allocated.
     
  35. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    Hi @BTStone,

    The version you're using (1.9) was released almost 2 years ago, so unfortunately I can't provide support for such old versions. On top of that, the entire Shake extension was remade from the ground-up on version 2.3.0 so things are very different now.

    Since version 2.3.0 there's a "ConstantShake" option that does exactly what you need. More info about that here: http://www.procamera2d.com/user-guide/extension-shake/
     
  36. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,157
    Mhm, I see, I found a workaround, so it's fine.
     
    luispedrofonseca likes this.
  37. Solid_Metal

    Solid_Metal

    Joined:
    Mar 25, 2015
    Posts:
    45
    so on my latest post that i asked, eventually i try to make my own custom camera, it works like i want it to, but unfortunately i can't/too lazy/ don't have enough time, to make it as smooth as what you did with your plugin

    so i plan to combine your plugin with my script which so far works OK, but theres problem i face right now regarding your plugin to work as i wanted it to, i might need your help to customize some part of your source code, may i message you by PM ?, i also can provice purchase license and things like that if needed
     
  38. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @Solid_Metal As I'm sure you understand, I can't provide support for custom functionality on your game. I'm happy to give you some hints on camera related code, so feel free to share here what you're trying to achieve.
     
  39. zapposh

    zapposh

    Joined:
    Nov 12, 2016
    Posts:
    94
    Hi,

    I'm on Unity 2017.2 and for months Pro Camera 2D was working fine, as well as its updates.
    Today I updated to the latest version of ProCam2D, and I get the following error message, and the game is not playable anymore. I changed nothing in my code.

    NullReferenceException: Object reference not set to an instance of an object
    Com.LuisPedroFonseca.ProCamera2D.ProCamera2DNumericBoundaries.AdjustDelta (Single deltaTime, Vector3 originalDelta) (at Assets/Plugins/ProCamera2D/Code/Extensions/ProCamera2DNumericBoundaries.cs:134)
    Com.LuisPedroFonseca.ProCamera2D.ProCamera2D.Move (Single deltaTime) (at Assets/Plugins/ProCamera2D/ProCamera2D.cs:710)
    Com.LuisPedroFonseca.ProCamera2D.ProCamera2D.LateUpdate () (at Assets/Plugins/ProCamera2D/ProCamera2D.cs:293)
     
  40. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @zapposh Hi, I can't replicate this issue on my side. Can you please send me (through PM) a sample project that replicates it?
     
  41. idavida

    idavida

    Joined:
    Nov 12, 2012
    Posts:
    29
    Hi! Awesome plugin, but I'm having a problem with using Forward Focus with Influence Triggers. I can't seem to get a useful result.

    What I want is something that smoothly moves my camera that has Forward Focus on (and preferably Camera Window as well, but that's a different story) towards a position. This is exactly what Influence Triggers does, but It's either too jaggy or too slow for the camera to lock on the position. The problem I guess is the created offset is messing with me.

    Easy concept, a 2D player and camerapro2d cam with forward focus runs right towards an object i want to highlight and pause the camera on. Either the camera fly past the object and moves back with a lerping motion, or the trigger use exclusive influence percentage and it really locks on, but its so stiff. For what I can see it doesnt really matter what values either on influence smoothness or EIP. Is this what you would recommend to use though if I'm looking to have my 2d-cam either focus on places in the world or for example if I want to help the player "look down" at certain leap of faith-kind-of jumps?

    OK, an update:
    I guess I need overlapping triggers for this to work, and having overlapping triggers interpolate my camera kind of bad since my triggers doesnt work that well with having an y-offset on my camera? Once inside a trigger my cameras prefered position keeps jumping upwards and past my trigger for it to lerp back towards the "real" target-position. Anything you know what it could be?

    Edit: Yeah, not using relative offset fixed it and I guess I should've tried something like it. But I wonder why it works like this still?
     
    Last edited: Dec 17, 2017
  42. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    154
    I have a similar issue with a different script error. It's also not consistent.

    I presume it is caused that by adding game objects to list in inspector to be used as focus points (i.e. one player and one enemy with different weights) and if I disable them at Awake or Start functions, ProCamera2D will sometimes throw a Null Pointer Exception as its inner list will be populated but could not find the game objects.

    This issue started with the latest update. I can't really roll back currently that commit (made some other changes too) and I'll look into some workaround until I can provide a replication package.
     
  43. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @idavida What you're trying to accomplish is a bit unclear to me. Can you please share a video or screenshot of the issue you're having?
     
  44. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @TanselAltinel Thanks! If you could find a way to replicate it would be great.
     
  45. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    154
    I feel a little dumb; but after I wrote it here and took another build, I've never encountered the error again.

    The reason I feel a little dumb is:

    Firstly, my enemy had a script field (for another script reference) that was left empty, though the exception is handled very nicely, reference should've been there; and I accidentally updated a prefab which caused that field to be left empty, which might be the real cause.

    Secondly, I used two workstations and in one of them whole library had to be re-imported (much like a deleted Library folder) and on that workstation I never had the issue to begin with.

    So, what I can say is, if anyone gets the issue, empty your Library folder and see if that helps. If it doesn't, check your list of gameobjects that are assigned to ProCamera2D as targets through inspector to see if they have any error.

    Through the commit history, I also checked the last update to ProCamera2D and I don't believe there is any change that will suddenly cause an issue like this. Though, I'm not the best programmer out there so this post might be needed to be taken with a grain of salt :D
     
  46. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
  47. idavida

    idavida

    Joined:
    Nov 12, 2012
    Posts:
    29
    So it comes down to this. I'm having two triggers close to eachother and want the camera to interpolate smoothly when player cross them. In this video we start out with having them abit apart, and then moving them closer. Notice how the camera dips down the completely other way when getting triggered creating the uneven motion? This is without any forward focus or camera window. Having two overlapping triggers with with same focus point works great.

    Playing around with exclusive influence percentage and influence smoothness doesnt do much.

    https://drive.google.com/open?id=10G5ZyqK2NEwWKEAGaYKuG1pjmGPxBn2I
     
  48. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    Hi @idavida, the reason that creates a certain "jump" is because your triggers have different sizes and relative positions to the player. The way the influence works is by calculating the camera target distance to the focus point (by default, the trigger center).
    If you want to reduce that effect you have to either make your triggers similarly sized and positioned and/or increase the trigger influence smoothness as well as the camera follow smoothness (on the core component).
    Let me know how it goes.
     
  49. idavida

    idavida

    Joined:
    Nov 12, 2012
    Posts:
    29
    Ah yeah, but I ment the smaller bumps since its not interpolating straight to the other triggers focus point. It's doing whats expected only that I'm not getting the straightest route towards the next point? It looks like its not even taking the current velocity from the camera to smooth the route to next focus point?
     
  50. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    850
    @idavida Can you please contact me through PM and send me a small sample project that replicates your issue?
     
unityunity