Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Assigning CCLayer.Viewport throws uninformative exception #223

Closed
vchelaru opened this issue Jun 1, 2015 · 1 comment
Closed

Assigning CCLayer.Viewport throws uninformative exception #223

vchelaru opened this issue Jun 1, 2015 · 1 comment

Comments

@vchelaru
Copy link

vchelaru commented Jun 1, 2015

Sample code:

var newViewport = new CCViewport(new CCRect(0,0, this.ContentSize.Width, this.ContentSize.Height),
    CCDisplayOrientation.Portrait);
layer.Viewport = newViewport;

Exception:

{System.NullReferenceException: Object reference not set to an instance of an object
  at CocosSharp.CCNode.set_Viewport (CocosSharp.CCViewport value) [0x00006] in <filename unknown>:0 
  at CoinTimeGame.Scenes.GameScene.ClipLayerForInputUi (CocosSharp.CCLayer layer) [0x0002e] in c:\Users\Victor\Documents\mobile-samples\CoinTime\CoinTime\Scenes\GameScene.cs:143 } System.NullReferenceException

layer is not null - the exception is occurring within the setter.

Expected result is that the exception should tell the user why this is an invalid operation, or to not throw an exception.

@rtabbara
Copy link
Member

With the upcoming ability to embed a view using CCGameView, a user can simply resize the view and hence the CCViewport class has been made redundant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants