Hey, so I just noticed that the main script I use in my editor randomly disappeared, and I can’t get it back. I tried forking it, but it wasn’t there. If you launch the actual game from the overview the script is still operable, which means it is still there, but I can’t revert to that point because I had done so much work since then. It’s a modified version of a tutorial script, its called picker_raycast.js
If anyone can help me get that back, it would be greatly appreciated.
Link: PlayCanvas 3D HTML5 Game Engine
yaustar
September 9, 2022, 1:35pm
#2
Have you been using Version Control to make checkpoints so you can get the previous version of the file?
Also, have you been deleting any assets/files etc recently and may have accidentally the file with multi select?
yaustar
September 9, 2022, 1:40pm
#3
If you are talking about the PLAY button mentioned here:
That’s from a published build. What the publish step does is build a version of the game and copies the built files to a web server folder
yaustar
September 9, 2022, 1:42pm
#4
This is the version of the PickerRaycast from the published build:
var PickerRaycast = pc.createScript("pickerRaycast");
PickerRaycast.attributes.add("distanceEnt", {
type: "entity",
description: "joe mama"
}),
PickerRaycast.attributes.add("screen", {
type: "entity",
description: "screen"
}),
PickerRaycast.attributes.add("ammoCount", {
type: "number",
description: "the ammo when the when"
}),
PickerRaycast.attributes.add("maxAmmo", {
type: "number",
description: "the ammo when the when"
}),
PickerRaycast.prototype.initialize = function() {
this.app;
this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.onSelect, this),
this.on("destroy", (function() {
this.app.mouse.off(pc.EVENT_MOUSEDOWN, this.onSelect, this)
}
), this)
}
,
PickerRaycast.prototype.update = function() {
this.app.keyboard.isPressed(pc.KEY_R) && (this.ammoCount = 20),
this.screen.element.text = this.ammoCount.toString() + " / " + this.maxAmmo.toString()
}
,
PickerRaycast.prototype.onSelect = function(t) {
if ((pc.Mouse.isPointerLocked() || t.buttons[0]) && t.button === pc.MOUSEBUTTON_LEFT && this.ammoCount > 0) {
this.ammoCount -= 1;
this.entity.camera.screenToWorld(t.x, t.y, this.entity.camera.nearClip),
this.entity.camera.screenToWorld(t.x, t.y, this.entity.camera.farClip);
var e = this.entity.getPosition()
, i = this.distanceEnt.getPosition()
, a = this.app.systems.rigidbody.raycastFirst(e, i);
if (a) {
var s = a.entity;
s.script && s.script.damage && s.script.damage.doDamage(5)
}
}
}
;