Well, like I said, I don’t have the implicit operator. I also watched the lecture again and don’t see Sam ever adding it (I only watched the one this post is linked to). So from my side, this is why I don’t have that issue. Because I don’t have that code.
My solution is just a wrapper around the LazyValue
wrapper to overcome the error you received by changing the ‘enclosing type’ to a lazy value that accepts float. Yes, you would use LazyFloat
instead of LazyValue<float>
but it will (should, at least) cast to LazyValue<float>
because technically it’s still the same thing.
Edit
Just went to the source repository and the LazyValue
in there does not have the implicit operator either.
See here: LazyValue.cs
I suspect your IDE decided to ‘help you out’ and created the operator. Even if you could do that, you would have received an error because the implementation is to throw a NotImplementedException
. I think you can safely remove the function