Obi Official Forum

Full Version: [ObiRope 4.1] Start and end prefabs are not deactivated when a rope is.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
(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.
Good !!