Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suggestion / Idea  Problem with the Obi Solver Structure
#11
(22-11-2019, 03:56 PM)Bill Sansky Wrote: Let me clarify my use case:

I have only one ObiRope in my prefab, but all my ropes must interact with each other. However my rope is not the root object of my prefab, it has other objects that have a different role, all under one "cable" object that can be pooled.

https://drive.google.com/open?id=1ENJLRx...sxl-LgNOZ4

That is why I need to check for all the parent transform since my ObiRope is not the root object

I get the point, it is useful to recursively check all transforms up here. Will make sure to cover this use case too.
Reply
#12
Awesome!

Thanks a lot for your support and for taking the time to listen, it means a lot Sonrisa
Reply
#13
(22-11-2019, 04:31 PM)Bill Sansky Wrote: Awesome!

Thanks a lot for your support and for taking the time to listen, it means a lot Sonrisa

It's thanks to user feedback like yours that things move in the right direction, so thank you for discussing these issues with me! Sonrisa.
Reply
#14
Hi Bill,

I slightly modified the actor's Awake method, to support multiple actors in the prefab's hierarchy without any downsides. It is also slightly cleaner and concise. Here's the updated version:

Code:
protected void Awake()
        {
#if UNITY_EDITOR

            // Check if this script's GameObject is in a PrefabStage
            var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetPrefabStage(gameObject);

            if (prefabStage != null)
            {
                // Only create a solver if there's not one up our hierarchy.
                if (GetComponentInParent<ObiSolver>() == null)
                {
                    // Add our own environment root and move it to the PrefabStage scene
                    var newParent = new GameObject("ObiSolver (Environment)", typeof(ObiSolver), typeof(ObiLateFixedUpdater));
                    newParent.GetComponent<ObiLateFixedUpdater>().solvers.Add(newParent.GetComponent<ObiSolver>());
                    UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene(newParent, gameObject.scene);
                    transform.root.parent = newParent.transform;
                }
            }
#endif
        }
Reply
#15
Awesome! Thanks a lot!
Reply