I am using Cocos Creator version 3.6.2, here is my issue:
I create two card,then i register touch event for each card that will process this:
this.node.setSiblingIndex(1);
When clicking on Clover 1 :
console: 1 sibling index: 1 //2 sibling index: 0
Here’s my problem: everytime i click on red areas, clover2 will change siblingindex to 1:
(after click):
console:1 sibling index: 0 //2 sibling index: 1.
Can anyone explain why??
Many thanks,
Koei
December 14, 2022, 7:17am
#2
parent.pauseSystemEvents(true);
node.setSiblingIndex(length - 1);
parent.resumeSystemEvents(true);
try this.
1 Like
anonus
December 14, 2022, 7:32am
#4
let uiTransform = this.node.getComponent(UITransform);
if (uiTransform)
uiTransform.priority = zIndex;
try this, i have tested, it work with me
use priority is better than setsibling in some case, its like zIndex in 2x, i have tried but you should use pauseSystemEvents as @Koei 's reply to avoid error.
1 Like
Koei
December 14, 2022, 8:36am
#6
opened 06:39AM - 15 Sep 22 UTC
Bug
ECO: Feedback
P2
### Cocos Creator version
3.6.0
### System information
window10
### Issue de… scription
current:
![76a721e3875f0c56678decdffa743770a9f135f1](https://user-images.githubusercontent.com/40415168/190331512-ba15d339-ebd3-4746-b52c-20ab5301d9d9.gif)
expected:
https://user-images.githubusercontent.com/40415168/190331784-b530dc6c-e600-447a-8d87-95b7c8a7fa5c.mp4
When the node ordering is modified, the event dispatching order is not rearranged;
当修改节点排序后,事件派发顺序没有重排
![image](https://user-images.githubusercontent.com/40415168/190332402-748b5fe7-c05b-4287-8c18-dea2995be3be.png)
### Relevant error log output
_No response_
### Steps to reproduce
demo:
[NewProject_12.zip](https://github.com/cocos/cocos-engine/files/9572537/NewProject_12.zip)
### Minimal reproduction project
_No response_
this is a bug, an issue has been created to handle it.a
1 Like
@Koei I’ve detected that your advice only works on Web preview, not in simulator or phone preview, any suggestions?
I find out this solution instead of using setsiblingindex():
var parent=this.node.parent;
this.node.removeFromParent();
parent.insertChild(this.node,position);
Koei
December 22, 2022, 3:35am
#10
cocos:v3.6.1
← dumganhar:fix/12772-pause-resume-event
opened 11:38AM - 14 Sep 22 UTC
Re: #12772
### Changelog
* fixed #12772: Node.pause/resumeSystemEvent not … working on native platform.
-------
### Continuous Integration
This pull request:
* [ ] needs automatic test cases check.
> Manual trigger with `@cocos-robot run test cases` afterward.
* [ ] does not change any runtime related code or build configuration
> If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.
-------
### Compatibility Check
This pull request:
* [ ] changes public API, and have ensured backward compatibility with [deprecated features](https://github.com/cocos/cocos-engine/blob/v3.5.0/docs/contribution/deprecated-features.md).
* [ ] affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
* [ ] affects file structure of the build package or build configuration which requires user project upgrade.
* [ ] **introduces breaking changes**, please list all changes, affected features and the scope of violation.
<!-- Note: Makes sure these boxes are checked before submitting your PR - thank you!
- [ ] Your pull request title is using English, it's precise and appropriate.
- [ ] If your pull request has gone "stale", you should **rebase** your work on top of the latest version of the upstream branch.
- [ ] If your commit history is full of small, unimportant commits (such as "fix pep8" or "update tests"), **squash** your commits down to a few, or one, discreet changesets before submitting a pull request.
- [ ] Document new code with comments in source code based on API docs
- [ ] Make sure any runtime log information in `log` , `error` or `new Error('')` has been moved into `EngineErrorMap.md` with an ID, and use `logID(id)` or `new Error(getError(id))` instead.
- To official teams:
- [ ] Check that your PR is following our [guides](https://github.com/cocos/3d-tasks/blob/master/workflows/readme.md)
-->
I tested it is normal,are you sure you are using 3.6.2? Or can you give a demo to see?
Native doesn’t work has been fixed before.
NewProject_3.zip (2.9 MB)
here, i try preview on simulator.
Koei
December 22, 2022, 8:42am
#13
Why is the project version 3.6.0 and not 3.6.2?
sorry my bad, i change version recently LOL, any differents?
Koei
December 22, 2022, 8:53am
#15
The native non-effective issue was fixed after 3.6.1, if you want to use 3.6.0, you need to merge this pr manually
1 Like