Friday, November 8, 2024
HomeGame DevelopmentThe way to deal with platform particular property? - Cocos Creator

The way to deal with platform particular property? – Cocos Creator


Hiya,

I’m utilizing Creator 3.4.2
I’m coming from Cocos2dx C++ so smartest thing about 2dx C++ was we are able to simply add macros in supply information and people information wont be added in last binary.
Could i do know what would be the comparable approach of doing the identical in Creator?
Not macros however what else we are able to do to attain identical?
Any automation whereas producing construct through Command line?
Shall we say platform particular we wont to alter few property as nicely then?

Thanks.
Regards,
Smit


@linrm So nothing doable for this?
Dont you suppose its required for cross-platform improvement?

you possibly can add macros right here in Creator :

construct through Command line check with: Publish from the Command Line · Cocos Creator

That i do know, however its easy if/else, proper?
code can be there in binaries.
And what about property?

sure, its easy now.
I didn’t perceive the query you talked about about property.

Suppose there are property which is platform particular, then how we are able to deal with that?

You could decide the present system platform of the sport. Use sys.platform, right here is the API documentation for it: CocosCreatorAPI 。

The property are then dealt with in numerous methods in numerous platforms.

@zzf520 That i do know however you aren’t getting my query correctly.

  1. What if on Android platform i need to present logo_android.png and on iOS I need to present logo_ios.png its simple to show this by sys.platform however in android apk it is going to comprise logo_ios.png as nicely, proper? which can improve dimension of ultimate construct, so i need to understand how we are able to keep away from this?
    And that is simply instance, there would possibly me lot of property platform dependant.
  2. Now take into account there are completely different fixed information based mostly on platforms.
    GameConstant_android.ts, GameConstant_iOS.ts and many others how can we keep away from additional information whereas constructing last builds?
    Additionally this fixed file is simply instance however their could be lot of platform particular scripts which we have to keep away from.
    Hopefully I’m able to clarify this now.
    I’m coming from 2dx-cpp so it was very simple to attain this.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments