- Home /
Question by
youvisit · Apr 14, 2015 at 10:15 PM ·
c#imagestandaloneosx
Using Image Component in OSX standalone app crashes build
I've an app that crashes only when running in standalone on OSX (in Editor works on all OSes and standalone works on Windows). I've narrowed the problem down to this line: backgroundObject.AddComponent ();
(line 14 below) - when commented out the app stops crashing. A little more of the surrounding code:
RectTransform r = gameObject.AddComponent<RectTransform> ();
r.sizeDelta = new Vector2 (100f, 100f);
r.localPosition = new Vector3 (0.01f, 0.17f, 0.53f);
r.localEulerAngles = Vector3.zero;
r.localScale = new Vector3 (0.001f, 0.001f, 0.001f);
Canvas c = gameObject.AddComponent<Canvas> ();
c.renderMode = RenderMode.WorldSpace;
c.pixelPerfect = false;
backgroundObject = new GameObject ();
backgroundObject.name = "Background";
backgroundObject.AddComponent<CanvasRenderer> ();
backgroundImage = backgroundObject.AddComponent<Image> ();
Any leads would be great, thanks!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613193136im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Is there a Color Matrix equivalent in Unity? 1 Answer
Best way to capture super large screenshot images (all GPUs) 0 Answers