Hello,guys,
I want to make a builder tool on editor mode(not runtime),so I want to make a prefab follow mouse to place.
I check some scripts on runtime mode,the logic looks OK.
When i use Camera.main
to calc ray ,it works fine.
but i notice on editor mode ,some SceneView.GetAllSceneCameras()
,i test it,but it can locate correct position.
Thanks!
Ray r = SceneView.GetAllSceneCameras()[0].ScreenPointToRay(Input.mousePosition);
Vector3 p = GetIN(r.origin, r.direction, Vector3.zero, Vector3.up);
PlacePrefab.transform.position = p;