Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounding box improperly uses LayerMask.NameToLayer #1592

Closed
StephenHodgson opened this issue Jan 5, 2018 · 3 comments
Closed

Bounding box improperly uses LayerMask.NameToLayer #1592

StephenHodgson opened this issue Jan 5, 2018 · 3 comments

Comments

@StephenHodgson
Copy link
Contributor

Overview

NameToLayer is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'BoundingBox' on game object 'BoundingBoxBasic'.
	See "Script Serialization" page in the Unity Manual for further details.
	UnityEngine.LayerMask:NameToLayer(String)
	HoloToolkit.Unity.UX.BoundingBox:.ctor() (at Assets/HoloToolkit/UX/Scripts/BoundingBoxes/BoundingBox.cs:175)
	
UnityException: NameToLayer is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'BoundingBox' on game object 'BoundingBoxBasic'.
	See "Script Serialization" page in the Unity Manual for further details.
	HoloToolkit.Unity.UX.BoundingBox..ctor () (at Assets/HoloToolkit/UX/Scripts/BoundingBoxes/BoundingBox.cs:175)
@StephenHodgson
Copy link
Contributor Author

@Railboy

@Railboy
Copy link
Contributor

Railboy commented Jan 5, 2018

Now I remember why I used an integer in the first place.

Removing the NameToLayer initialization will result in an empty mask by default, which is perfectly acceptable. Let's make that change immediately.

@StephenHodgson
Copy link
Contributor Author

I've already got a fix

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

No branches or pull requests

3 participants