Help Addition of Obi Collider - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html) +--- Thread: Help Addition of Obi Collider (/thread-1025.html) |
Addition of Obi Collider - Richard - 29-03-2019 Hello. This is very basic question, but I cannot add Obi collider by AddComponent. My code is. using System.Collections; using System.Collections.Generic; using UnityEngine; public class ManSetting : MonoBehaviour { public GameObject man; // Start is called before the first frame update void Start() { man.AddComponent<MeshCollider>(); man.AddComponent<ObiCollider>(); } } However, error massage is displayed like the image. RE: Addition of Obi Collider - Evgenius - 29-03-2019 (29-03-2019, 09:12 AM)Richard Wrote: Hello. You forgot to include the Obi library. Add "using Obi;" to other usings in the top of the script. RE: Addition of Obi Collider - Richard - 29-03-2019 (29-03-2019, 09:18 AM)Evgenius Wrote: You forgot to include the Obi library. Add "using Obi;" to other usings in the top of the script. That does not solve error. What is the other error? RE: Addition of Obi Collider - Evgenius - 29-03-2019 (29-03-2019, 09:50 AM)Richard Wrote: That does not solve error. What is the other error? I can't see the log of the second error. Show the log and the string of code it's linked to. RE: Addition of Obi Collider - Richard - 29-03-2019 (29-03-2019, 09:53 AM)Evgenius Wrote: I can't see the log of the second error. Show the log and the string of code it's linked to. Second one is: Assets\ManSetting.cs(12,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement RE: Addition of Obi Collider - Evgenius - 29-03-2019 (29-03-2019, 10:03 AM)Richard Wrote: Second one is: And what about code? RE: Addition of Obi Collider - Richard - 29-03-2019 (29-03-2019, 10:07 AM)Evgenius Wrote: And what about code? using System.Collections; using System.Collections.Generic; using UnityEngine; using Obi; public class ManSetting : MonoBehaviour { public GameObject man; void Start() { man.AddComponent<MeshCollider>(); man.AddComponent<ObiCollider>(); } // Update is called once per frame void Update() { Transform myTransform = this.transform; Vector3 localScale = myTransform.localScale; } } RE: Addition of Obi Collider - Evgenius - 29-03-2019 (29-03-2019, 10:14 AM)Richard Wrote: using System.Collections; I copied your script to my project and got no errors. Write the exact code string that error is linked to. (P.S., caching transform is good practice, but you're doing it wrong. Caching transform every update makes no sense and will do you no good.) |