{"action":"created","issue":{"url":"https://api.github.com/repos/gameup-io/gameup-unity-sdk/issues/6","labels_url":"https://api.github.com/repos/gameup-io/gameup-unity-sdk/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/gameup-io/gameup-unity-sdk/issues/6/comments","events_url":"https://api.github.com/repos/gameup-io/gameup-unity-sdk/issues/6/events","html_url":"https://github.com/gameup-io/gameup-unity-sdk/issues/6","id":94417985,"number":6,"title":"Trying to create a MonoBehaviour using the 'new' keyword in sample program.","user":{"login":"M2tM","id":923621,"avatar_url":"https://avatars.githubusercontent.com/u/923621?v=3","gravatar_id":"","url":"https://api.github.com/users/M2tM","html_url":"https://github.com/M2tM","followers_url":"https://api.github.com/users/M2tM/followers","following_url":"https://api.github.com/users/M2tM/following{/other_user}","gists_url":"https://api.github.com/users/M2tM/gists{/gist_id}","starred_url":"https://api.github.com/users/M2tM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/M2tM/subscriptions","organizations_url":"https://api.github.com/users/M2tM/orgs","repos_url":"https://api.github.com/users/M2tM/repos","events_url":"https://api.github.com/users/M2tM/events{/privacy}","received_events_url":"https://api.github.com/users/M2tM/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-11T00:21:52Z","updated_at":"2015-07-11T00:31:06Z","closed_at":null,"body":"It appears to me (with not a *whole lot* of digging, so it may be a deeper issue) that SessionClient.cs is trying to new a WWWRequest which is itself some kind of singletonmonobehavior which is derived from Monobehaviour\r\n\r\nI am getting tons of these warnings:\r\n\r\nYou are trying to create a MonoBehaviour using the 'new' keyword.  This is not allowed.  MonoBehaviours can only be added using AddComponent().  Alternatively, your script can inherit from ScriptableObject or no base class at all\r\nUnityEngine.MonoBehaviour:.ctor()\r\nGameUp.SingletonMonoBehaviour`1:.ctor()\r\nGameUp.WWWRequest:.ctor(MonoBehaviour, Uri, String, String, String)\r\nGameUp.WWWRequest:.ctor(Uri, String, String, String)\r\nGameUp.Client:Ping(SuccessCallback, ErrorCallback)\r\nGameUp.Client:Ping(ErrorCallback)\r\nGameUpTest:Start() (at Assets/GameUpTest.cs:31)\r\n\r\nWithout digging much further, I don't know if this warning is actually causing undesired behaviour, maybe you're somehow getting around the issue, but monobehaviours created with \"new\" typically don't function with coroutines as they aren't attached properly to game objects.\r\n\r\nEven if this is not an issue, the warning spam is pretty messy. Attaching them to a gameObject would be preferrable. You may want to mark that gameobject with DontDestroyOnLoad as well: http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html\r\n\r\nAny thoughts?"},"comment":{"url":"https://api.github.com/repos/gameup-io/gameup-unity-sdk/issues/comments/120555990","html_url":"https://github.com/gameup-io/gameup-unity-sdk/issues/6#issuecomment-120555990","issue_url":"https://api.github.com/repos/gameup-io/gameup-unity-sdk/issues/6","id":120555990,"user":{"login":"M2tM","id":923621,"avatar_url":"https://avatars.githubusercontent.com/u/923621?v=3","gravatar_id":"","url":"https://api.github.com/users/M2tM","html_url":"https://github.com/M2tM","followers_url":"https://api.github.com/users/M2tM/followers","following_url":"https://api.github.com/users/M2tM/following{/other_user}","gists_url":"https://api.github.com/users/M2tM/gists{/gist_id}","starred_url":"https://api.github.com/users/M2tM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/M2tM/subscriptions","organizations_url":"https://api.github.com/users/M2tM/orgs","repos_url":"https://api.github.com/users/M2tM/repos","events_url":"https://api.github.com/users/M2tM/events{/privacy}","received_events_url":"https://api.github.com/users/M2tM/received_events","type":"User","site_admin":false},"created_at":"2015-07-11T00:31:06Z","updated_at":"2015-07-11T00:31:06Z","body":"It's a warning in Unity 4.6 as well, not an error, but it is a warning precisely because monobehaviors rely on being in the scene graph to get certain update/coroutine/message broadcast behaviors. If you don't rely on any of this it's not an outright error, but it is something that should be/can be fixed quickly. :)"}}