Tag Archives: cocos create

How to Solve Cocos creator label text is too many error

Cocos creator label text is too many and an error is reported

There are thousands of lines of legal entries such as user agreements and privacy terms

That’s what it said

let labelNode = new Node('labelNode')
let label = labelNode.addComponent(Label)
label.cacheMode = Label.CacheMode.CHAR
label.string = '....' 

In this way, it can be loaded at once, and the protocol can be closed. When loading other protocols, an error of too long font size will be reported

After a long toss, the characters here are too long to keep the cache. Change the cachemode to none, but even none can’t load so much. Just write in several paragraphs

let a1 = ""
let a2 = ""
let a3 = ""
this.addLabel('a1', 0, a1)
this.addLabel('a2', -2000, a2)
this.addLabel('a3', -4000, a3)
addLabel(name:string, y: number, text:string){
	let labelNode = new Node(name)
	labelNode.layer = Layers.BitMask.UI_2D
	labelNode.setPosition(0, y)
	let label = labelNode.addComponent(Label)
	label.cacheMode = Label.CacheMode.NONE
	label.string = text
	this.node.addChild(labelNode)
}