@@ -64,6 +64,7 @@ public class JCS_UnityObject : MonoBehaviour
6464 public void SetObjectType ( JCS_UnityObjectType ob )
6565 {
6666 mObjectType = ob ;
67+
6768 UpdateUnityData ( ) ;
6869 }
6970 public JCS_UnityObjectType GetObjectType ( ) { return mObjectType ; }
@@ -257,6 +258,7 @@ public Transform localTransform
257258 }
258259
259260 Debug . LogError ( "Return default local position (This should not happens)" ) ;
261+
260262 return transform ;
261263 }
262264 }
@@ -335,6 +337,7 @@ public Vector3 position
335337 }
336338
337339 Debug . LogError ( "Return default local position (This should not happens)" ) ;
340+
338341 return transform . position ;
339342 }
340343
@@ -384,7 +387,9 @@ public Vector3 localPosition
384387 return mTextMesh . transform . localPosition ;
385388#endif
386389 }
390+
387391 Debug . LogError ( "Return default local position (This should not happens)" ) ;
392+
388393 return transform . localPosition ;
389394 }
390395
@@ -436,6 +441,7 @@ public Vector3 eulerAngles
436441 }
437442
438443 Debug . LogError ( "Return default local rotation (This should not happens)" ) ;
444+
439445 return transform . eulerAngles ;
440446 }
441447
@@ -487,6 +493,7 @@ public Vector3 localEulerAngles
487493 }
488494
489495 Debug . LogError ( "Return default local rotation (This should not happens)" ) ;
496+
490497 return transform . localEulerAngles ;
491498 }
492499
@@ -536,7 +543,9 @@ public Vector3 localScale
536543 return mTextMesh . transform . localScale ;
537544#endif
538545 }
546+
539547 Debug . LogError ( "Return default local scale (This should not happens)" ) ;
548+
540549 return transform . localScale ;
541550 }
542551
@@ -560,6 +569,7 @@ public Vector3 localScale
560569 return ;
561570#endif
562571 }
572+
563573 Debug . LogError ( "Set default local scale (This should not happens)" ) ;
564574 }
565575 }
@@ -586,7 +596,9 @@ public bool localEnabled
586596 return mTextMesh . enabled ;
587597#endif
588598 }
599+
589600 Debug . LogError ( "Return default visible (This should not happens)" ) ;
601+
590602 return false ;
591603 }
592604
@@ -625,14 +637,11 @@ private Color GetColor()
625637 return mRenderer . material . GetColor ( prop ) ;
626638 }
627639
628- try
629- {
630- return mRenderer . material . color ;
631- }
632- catch
633- {
634- // ignore
635- }
640+ Material mat = mRenderer . material ;
641+
642+ // The `.color` and `GetColor("_Color")` is equivalent.
643+ if ( mat && mat . HasProperty ( "_Color" ) )
644+ return mat . color ;
636645
637646 return Color . white ;
638647 }
@@ -647,14 +656,11 @@ private void SetColor(Color val)
647656 mRenderer . material . SetColor ( prop , val ) ;
648657 }
649658
650- try
651- {
652- mRenderer . material . color = val ;
653- }
654- catch
655- {
656- // ignore
657- }
659+ Material mat = mRenderer . material ;
660+
661+ // The `.color` and `GetColor("_Color")` is equivalent.
662+ if ( mat && mat . HasProperty ( "_Color" ) )
663+ mat . color = val ;
658664 }
659665
660666 /// <summary>
@@ -681,6 +687,7 @@ public Color localColor
681687 }
682688
683689 Debug . LogError ( "Return default Local Red (This should not happens)" ) ;
690+
684691 return new Color ( 255 , 128 , 64 , 32 ) ;
685692 }
686693
@@ -707,6 +714,7 @@ public Color localColor
707714#endif
708715
709716 }
717+
710718 Debug . LogError ( "Set default Local Red (This should not happens)" ) ;
711719 }
712720 }
@@ -733,7 +741,9 @@ public float localAlpha
733741 return mTextMesh . color . a ;
734742#endif
735743 }
744+
736745 Debug . LogError ( "Return default Local Alpha (This should not happens)" ) ;
746+
737747 return 0 ;
738748 }
739749
@@ -781,6 +791,7 @@ public float localAlpha
781791 return ;
782792#endif
783793 }
794+
784795 Debug . LogError ( "Set default Local Alpha (This should not happens)" ) ;
785796 }
786797 }
@@ -807,7 +818,9 @@ public float localRed
807818 return mTextMesh . color . r ;
808819#endif
809820 }
821+
810822 Debug . LogError ( "Return default Local Red (This should not happens)" ) ;
823+
811824 return 0 ;
812825 }
813826
@@ -855,6 +868,7 @@ public float localRed
855868 return ;
856869#endif
857870 }
871+
858872 Debug . LogError ( "Set default Local Red (This should not happens)" ) ;
859873 }
860874 }
@@ -881,7 +895,9 @@ public float localGreen
881895 return mTextMesh . color . g ;
882896#endif
883897 }
898+
884899 Debug . LogError ( "Return default Local Green (This should not happens)" ) ;
900+
885901 return 0 ;
886902 }
887903
@@ -929,6 +945,7 @@ public float localGreen
929945 return ;
930946#endif
931947 }
948+
932949 Debug . LogError ( "Set default Local Blue (This should not happens)" ) ;
933950 }
934951 }
@@ -955,7 +972,9 @@ public float localBlue
955972 return mTextMesh . color . b ;
956973#endif
957974 }
975+
958976 Debug . LogError ( "Return default Local Blue (This should not happens)" ) ;
977+
959978 return 0 ;
960979 }
961980
@@ -1003,6 +1022,7 @@ public float localBlue
10031022 return ;
10041023#endif
10051024 }
1025+
10061026 Debug . LogError ( "Set default Local Blue (This should not happens)" ) ;
10071027 }
10081028 }
@@ -1029,7 +1049,9 @@ public Texture localMainTexture
10291049 return mTextMesh . material . mainTexture ;
10301050#endif
10311051 }
1052+
10321053 Debug . LogError ( "Return default Local Blue (This should not happens)" ) ;
1054+
10331055 return null ;
10341056 }
10351057
@@ -1055,6 +1077,7 @@ public Texture localMainTexture
10551077 return ;
10561078#endif
10571079 }
1080+
10581081 Debug . LogError ( "Set default Local Blue (This should not happens)" ) ;
10591082 }
10601083 }
@@ -1073,7 +1096,9 @@ public Sprite localSprite
10731096 case JCS_UnityObjectType . UI :
10741097 return mImage . sprite ;
10751098 }
1099+
10761100 Debug . LogError ( "Failed to get sprite composite cuz current unity object setting does not have it." ) ;
1101+
10771102 return null ;
10781103 }
10791104
@@ -1088,6 +1113,7 @@ public Sprite localSprite
10881113 mImage . sprite = value ;
10891114 return ;
10901115 }
1116+
10911117 Debug . LogError ( "Failed to set the sprite cuz the current unity object setting does not have sprite coposite." ) ;
10921118 }
10931119 }
@@ -1111,7 +1137,9 @@ public bool localIsVisible
11111137 case JCS_UnityObjectType . SPRITE :
11121138 return mSpriteRenderer . isVisible ;
11131139 }
1140+
11141141 Debug . LogError ( "Return default Local isVisible (This should not happens)" ) ;
1142+
11151143 return false ;
11161144 }
11171145
@@ -1138,7 +1166,9 @@ public bool localFlipX
11381166#endif
11391167 return JCS_Mathf . IsPositive ( mRectTransform . localScale . x ) ;
11401168 }
1169+
11411170 Debug . LogError ( "Return default Local FlipX (This should not happens)" ) ;
1171+
11421172 return false ;
11431173 }
11441174
@@ -1180,6 +1210,7 @@ public bool localFlipX
11801210 }
11811211 return ;
11821212 }
1213+
11831214 Debug . LogError ( "Set default Local FlipX (This should not happens)" ) ;
11841215 }
11851216 }
@@ -1205,7 +1236,9 @@ public bool localFlipY
12051236#endif
12061237 return JCS_Mathf . IsPositive ( mRectTransform . localScale . y ) ;
12071238 }
1239+
12081240 Debug . LogError ( "Return default Local FlipY (This should not happens)" ) ;
1241+
12091242 return false ;
12101243 }
12111244
@@ -1247,6 +1280,7 @@ public bool localFlipY
12471280 }
12481281 return ;
12491282 }
1283+
12501284 Debug . LogError ( "Set default Local FlipY (This should not happens)" ) ;
12511285 }
12521286 }
0 commit comments