Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Wow ! Thanks a lot for the quick answer !

I'll look into that link and try to make it as clean as I can. Thanks again ^^

Anytime! And good luck :D

Hello again ! I don't mean to ask too much, but I happen to have a question about the method you shared on the question page.

I have followed all steps and looked at the script used to rescale the camera, and I have been greeted with 3 errors :

Here is the console

I tried to specify arguments by changing :

RectTransform rt = gameObject.GetComponent ();

To

RectTransform rt = gameObject.GetComponent<RectTransfom> ();

Then Unity crashed. I don't really know what to do with this error. Did I miss something ? Is it a version issue ? (I'm working on 5.4.0b19 Personal, but know a friend who has the same issue on version 5.4.1f1 Personal)

Anyway, thanks for your help, we're really lost ^^'

Arrghhh sorry.

It's the friggin' wordpress editor, it keeps removing < > tags every time I update it.

Do a ctrl+f for "GetComponent" every instance of it should be in the format

gameObject.GetComponent<TypeOfComponentYouNeed>();

so in your instance

RectTransform rt = gameObject.GetComponent<RectTransform>();

should be correct, if it's crashing that's really odd. Make sure it's attached to the correct object and that it actually has the correct UI components attached.

If you have any further issues let me know :)

Hmm, so we added "<GetComponent>", added "using UnitiyEngine.UI" (also tried without it), and well the script still crashes Unity. Gray areas for us right now would be :

-Must the script be attached to the RawImage or to something else ?

-We had to change m_VirtualScreen to "Sprite/Default" in order to toggle "Pixel snap". Could that be an issue ?

-Before adding the second camera, no change is visible. Do you have any idea what could cause this problem ?

Right now, we don't really know what more we could do, so if you have any ideas, let us know :D

I've zipped up the project file for you to take a look at, and see if there's any differences between yours and mine.


http://sabercathost.com/G3j/VirtualCameraTutorial....


Yeah the scaling script needs to go on the RawImage object. But I'm not sure why it would be crashing rather than just not working/compiling.

We tried to match as many settings as we could, but couldn't make it work. Here is a version of the project including the script and some assets, maybe you can see something that's wrong. Until then, I will work without it, and try again if I have any more time.


Thanks for your help anyway if we can't find a solution. It still helped me understand a few things about Unity :D

Getting a lot of errors trying to download and open that when google drive does it's thing.

Try zipping the entire project and just sharing that. I'll take a look and try to fix it.

Hmmm, that's weird. Try This link maybe ?

Thanks, that works fine.

So, good news is the project works just fine for me. So it may be an issue with your installation of unity or your machine. Bad news is that means I have absolutely no idea what's wrong :\ sorry