Hello. I’d like to have the ability to have a element property that permits a number of picks within the Inspector. For some physics settings, I’ve managed to create a dropdown to permit me to select a layer from these listed within the Node layer supervisor however I’m struggling in relation to permitting the person to pick out a number of layers (like you possibly can within the inspector for the Digicam element’s Visibility property). As soon as I’ve this, it’s straightforward to know which layers I can use for particular raycasts and so forth.
I’ve tried to make customized property drawers with assist from the docs and different on-line sources however none of those work (some even give examples which register the drawer to the Editor module utilizing Editor.addPropertyDrawer however I can not find the Editor module in CC3.8.5 because it’s not listed within the Undertaking Settings, Preferences or the Extension Supervisor).
In Unity, I can simply use a LayerMask however there doesn’t appear to be an equal in CC. Any assist or steering could be most welcome as I’m new to Cocos.
I simply search for engine supply code of Digicam element, possibly this might provide help to:
@property({serializable: true})
_visibility: quantity = pipeline.CAMERA_DEFAULT_MASK
@kind(Layers.BitMask)
get visibility () {
return this._visibility
}
set visibility (val) {
this._visibility = val;
}
and don’t neglect to import:
import { _decorator, Part, Layers, pipeline } from 'cc';
const { ccclass, property, kind } = _decorator;
Thanks a lot, that labored completely! I had tried the Layers.BitMask strategy however it will solely ever show as a quantity within the Inspector. I solely had a fast have a look at the definition recordsdata for the Digicam element, not the complete supply code on GitHub, so by no means noticed the usage of @kind earlier than the property get/set. I’m not used to having full supply code entry to an engine so will word this for future issues.
simply so , engine supply code is on the market at C:ProgramDatacocoseditorsCreator (default set up)
Thanks as soon as once more! Beats trawling GitHub 8)