I upgraded a old game to Unity 5.6p3 and some of the levels do not work as expected.
There no error messages in the console, just the original code does not seem to function correctly
using latest Unity. The code in particular is below.
Any ideas, using Orthographic projection
if(trigger.triggerType == TriggerType.hide)
{
Vector3 v = Camera.main.ViewportToWorldPoint (new Vector3 (0.5f, 0.5f, 0));
v += transform.forward * -30.0f;
linecastPos = v;
//#if UNITY_EDITOR
Debug.DrawLine (trigger.hiddenBlock.gameObject.transform.position, linecastPos, Color.red);
//#endif
}
I wonder if line 5 could be a problem: assigning a local Vector3 which is destroyed after the “if”. I think the only one constructor requires explicit values x,y,z.
Could you try if this code changes something?
I see. But, why do you think the error comes from this piece of code, and not from elsewhere? And, could you explain a bit which is the “unexpected” behavior? I’m a bit lost with little information…