Unityã®ã¨ãã£ã¿æ¡å¼µã§ãå®éã«ä½¿ãåæã®è¯ã使ã£ã¦ä¾¿å©ã§æä½éãªã¨ãã£ã¿æ¡å¼µææ³ãç´¹ä»ãããã¨æããä»ã«ããUnityãã¨ãã£ã¿æ¡å¼µãã§æ¤ç´¢ããã°è²ã
ã¨åºãããå°ãªãã¨ãèªåã¯ããã ãã§ä½ã¨ããªã£ã¦ãã OnValidate OnValidateã使ç¨ããã¨ãã¨ãã£ã¿ããã¤ã³ã¹ãã¯ã¿ã¼ã®å¤ãå¤æ´ããéã«å¼ã°ããã ä¾ãã°OnValidateã«å¤ã®max-minãè¨å®ããå¦çãè¨è¿°ãã¦ããã°ãå¤ãªå¤ãå
¥ããªããªããã ã¤ã³ã¹ãã¯ã¿ã¼ã®å¤ãå¤æ´ããéã«ä½ãå¦çãå®è¡ãããå ´åã使ããã ãã ãããã®é
ç®ã§ãªãã¸ã§ã¯ããçæãããã¨ã¯åºæ¥ãªãã MonoBehaviourãç¶æ¿ããã¯ã©ã¹ã«ä¸ã®ã¹ã¯ãªãããè¨è¿°ããã public int speed = 5; void OnValidate() { speed = Mathf.Clamp(speed, 0, 10); } åèï¼ MonoBe
{{#tags}}- {{label}}
{{/tags}}