Quantcast
Channel: Latest Questions by guto-thomas
Viewing all articles
Browse latest Browse all 84

ScreenToWorldPoint not working propertly in the editor?

$
0
0
*This question is a continuation of [this one][1]. Hey everyone! My problem is the following: When I want to place an object at the borders of the camera in the editor, this gives me strange results, but when I execute the same code in game it works. Why? Here's some image of what's happening: ![alt text][2] The code that is executed in the editor is the following: using UnityEngine; using UnityEditor; [CustomEditor(typeof(GUIZoneElementAllignment))] public class GUIZoneElementAllignmentEditor : Editor { private GUIZoneElementAllignment _target; public override void OnInspectorGUI () { _target = (GUIZoneElementAllignment)target; _target.allignment = (GUIZoneUtility.Allignment)EditorGUILayout.EnumPopup("Allignment", _target.allignment); if(GUI.changed) _target.allign(); } } the allign function: public void allign () { this.transform.position = GUIZoneUtility.allignElement(this.transform, this.allignment); } And here's the code executed in the start function of another script that I create just to test: public class Test : MonoBehaviour { void Start () { transform.position = GUIZoneUtility.allignElement(this.transform, GUIZoneUtility.Allignment.BottomLeft); } } I can't just see Why this is happening... It's a pretty weird problem, except if I'm missing some stupid thing. Any idea? Thanks from now! [1]: http://answers.unity3d.com/questions/281734/screentoworldpoint-giving-strange-results.html [2]: /storage/temp/1774-error.jpg

Viewing all articles
Browse latest Browse all 84

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>