Obi Official Forum
Bug / Crash [ObiRope 4.1] Start and end prefabs are not deactivated when a rope is. - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Bug / Crash [ObiRope 4.1] Start and end prefabs are not deactivated when a rope is. (/thread-1626.html)



[ObiRope 4.1] Start and end prefabs are not deactivated when a rope is. - VincentFTS - 22-01-2020

Hi,

I have a rope with both start and end prefabs filled. When I deactivate the rope, the prefabs instances are still viewable whereas they shouldn’t.

Thanks for your help.

Vincent


RE: [ObiRope 4.1] Start and end prefabs are not deactivated when a rope is. - josemendez - 23-01-2020

(22-01-2020, 11:17 AM)VincentFTS Wrote: Hi,

I have a rope with both start and end prefabs filled. When I deactivate the rope, the prefabs instances are still viewable whereas they shouldn’t.

Thanks for your help.

Vincent

Hi Vincent,

You can add this code anywhere in ObiRopeBase.cs to fix that:

Code:
public override void OnEnable()
        {
            base.OnEnable();
            if (startPrefabInstance != null)
                startPrefabInstance.SetActive(true);
            if (endPrefabInstance != null)
                endPrefabInstance.SetActive(true);
        }

        public override void OnDisable()
        {
            base.OnDisable();
            if (startPrefabInstance != null)
                startPrefabInstance.SetActive(false);
            if (endPrefabInstance != null)
                endPrefabInstance.SetActive(false);
        }

Let me know how it goes.


RE: [ObiRope 4.1] Start and end prefabs are not deactivated when a rope is. - VincentFTS - 27-01-2020

Good !!