コード例 #1
0
        /// <summary>
        /// Set the object into the scene layer in the scene.
        /// </summary>
        /// <param name="jcsOlo"> object u want to set to that specific scene layer </param>
        /// <param name="orderLayerIndex"> index of scene layer </param>
        public void SetObjectParentToOrderLayerByOrderLayerIndex(ref JCS_OrderLayerObject jcsOlo, int orderLayerIndex)
        {
            if (jcsOlo == null)
            {
                JCS_Debug.LogWarning(
                    "The 'JCS_OrderLayerObject' object you trying to set is null references...");
                return;
            }

            // get the order layer by order layer index!
            JCS_OrderLayer jcsol = GetOrderLayerByOrderLayerIndex(orderLayerIndex);

            if (jcsol == null)
            {
                JCS_Debug.LogWarning(
                    "Did not find the layer you willing to set to..., Layer Index: " + orderLayerIndex);
                return;
            }

            // set parent
            jcsOlo.transform.SetParent(jcsol.transform);

            // set order layer to the pass in object.
            jcsOlo.SetOrderLayer(orderLayerIndex);
        }